In WooCommerce, I would like to create a function that displays a simple “list” of data for each variant or variable product. Or, if a simple product, then the details of the product itself. Details that I need to include for each is: regular price, size attribute(used for options) sale price, stock.
This is for the "catalog" version of the WooCommerce product pages, so there will be no actual "Add to Cart" or "Change" button. Instead, I want to provide the user with information about each product / variation.
I need to output the data of each of them as list items in <ul>. New <ul>for every option.
Product example with three options:
<div class="fs-product-data-wrapper">
<ul>
<li class="fs-data-price">$49.98 ea.</li>
<li class="fs-data-size">Size: 15-18"</li>
<li class="fs-data-sale">$49.98 ea. Preferred Customer Price</li>
<li class="fs-data-stock">Quantity in Stock: 40</li>
</ul>
<ul>
<li class="fs-data-price">$799.98 ea.</li>
<li class="fs-data-size">Size: 2-2.5'</li>
<li class="fs-data-sale">$67.98 ea. Preferred Customer Price</li>
<li class="fs-data-stock">Quantity in Stock: 15</li>
</ul>
<ul>
<li class="fs-data-price">$29.98 ea.</li>
<li class="fs-data-size">Size: 12"</li>
<li class="fs-data-sale">$19.98 ea. Preferred Customer Price</li>
<li class="fs-data-stock">Quantity in Stock: 0</li>
</ul>
</div>
The product example is unchanged, but it is just a simple product:
<div class="fs-product-data-wrapper">
<ul>
<li class="fs-data-price">$99.98 ea.</li>
<li class="fs-data-size">Size: 15-18"</li>
<li class="fs-data-sale">$99.98 ea. Preferred Customer Price</li>
<li class="fs-data-stock">Quantity in Stock: 32</li>
</ul>
</div>
Example screenshot:

I can control CSS. I just need the ability to create this data within ulfor each option. Ideally, this can also be done using short code, as I will fill it with the page builder template. But I could do this if he hooks onto an existing product page hook. Maybe woocommerce_after_single_product.
source
share