In Woocommerce, I would like to create a function that outputs a simple HTML table with height
, width
, regular price
, and sale price
for each variation
of a variable product.
For example, let's say that the variable product comes with three variations with different dimensions and I need to make my function output this 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>
I am not sure how to build a function for this so I can add it into woocommerce_after_single_product
action inside content-single-product.php
.