O
O
obemgcabazn2019-09-19 16:04:15
WooCommerce
obemgcabazn, 2019-09-19 16:04:15

How to hide the price of a variation if this variation is out of stock?

We automatically update the prices and balances of the online store from the 1s database, the prices in 1s are stored in the price list and they are valid for the purchase of goods from stock (the price may change under the order).
Goods are variable. It is necessary to hide the price for a specific variation that is out of stock, but the variation should continue to be loaded on the product card so that users can see that such an article exists.
The theme file /woocommerce/single-product/add-to-cart/variation.php has this code:

<script type="text/template" id="tmpl-variation-template">
  <div class="woocommerce-variation-description">{{{ data.variation.variation_description }}}</div>
  <div class="woocommerce-variation-price">{{{ data.variation.price_html }}}</div>
  <div class="woocommerce-variation-availability">{{{ data.variation.availability_html }}}</div>
</script>

But I don't know how to do a stock check to hide the price.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question