0

I have a setup. For products, I display prices with VAT (info added in the suffix). However, I must include a net price under this price (only in single-product-view). In addition, I have products that are without a price and with them using the Call For Price plugin to display a button to send a price inquiry.

I display the net price adding:

<?php echo woocommerce_price ($ product-> get_price_excluding_tax ()); ?>

added in the template /woocommerce/single-product/price.php.

The problem is that in the case of a product without a price, I still see this value without tax (net) with the amount of 0.00. This one with VAT is deleted automatically.

How could I remove this net price in products that do not have the price indicated?

0

I'd try to add a condition :

<?php if(woocommerce_price ($product-> get_price_excluding_tax ()) != '0.00') // If price is not equal to 0.00 { echo woocommerce_price ($product-> get_price_excluding_tax ()); }
?>

Let me know if it worked !

3
  • Unfortunately price is still visible. Product has set no price (empty price field) and displays on product page 0,00. If I set price to 0 for product, on page I see 0,00 with VAT and 0,00 (net)
    – Pat
    Jan 15 '18 at 13:42
  • hum... can we try with this ? <?php if( !empty(woocommerce_price ($product-> get_price_excluding_tax ()))) { echo woocommerce_price ($product-> get_price_excluding_tax ()); } ?> Jan 15 '18 at 13:44
  • Still 0,00 is visible
    – Pat
    Jan 15 '18 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.