【发布时间】:2018-03-02 16:38:20
【问题描述】:
在 Woocommerce 中,我想创建一个函数,它为 变量产品的每个 variation 输出一个简单的 HTML 表,其中包含 height、width、regular price 和 sale price >。
例如,假设变量 product 带有三个不同尺寸的变体,我需要让我的函数输出这个 HTML:
<table>
<thead>
<tr>
<th>Height</th>
<th>Width</th>
<th>Regular price</th>
<th>Sale price</th>
</tr>
</thead>
<tbody>
<tr>
<td>180cm</td>
<td>100cm</td>
<td>224€</td>
<td>176€</td>
</tr>
<tr>
<td>210cm</td>
<td>125cm</td>
<td>248€</td>
<td>200€</td>
</tr>
<tr>
<td>240cm</td>
<td>145cm</td>
<td>288€</td>
<td>226€</td>
</tr>
</tbody>
我不确定如何为此构建一个函数,因此我可以将其添加到 content-single-product.php 内的 woocommerce_after_single_product 操作中。
如何做到这一点?
非常感谢任何帮助。
【问题讨论】:
标签: php html wordpress woocommerce variations