1

I use woocommerce.

In my product page, I have changed the code in price.php to show both price inclusive and exclusive taxes. But for some products, there is no price and they have to contact us to get the price. So when the price is empty, I don't want to show the text with the prices.

I have combined some code that I found, with the code I already had, but it doesn't really work, I keep getting the "excl. BTW €0,00 incl. BTW" text, even when the price of the product is empty.

<p class="price"><?php if( !empty(woocommerce_price ($product-> get_price_excluding_tax ()))) { echo $product->get_price_html() . ' excl. BTW<br />' . wc_price( wc_get_price_including_tax( $product ) ) . ' incl. BTW'; } ?></p>

Thanks in advance!

rebirth
  • 23
  • 4
  • Code you're using to change how something in Wordpress functions should not contain HTML tags outside of the PHP if you're implementing it through `functions.php`. If you're implementing it directly into a template, hopefully you're doing it in one in a child theme. – Justin R. Jun 12 '18 at 16:57

0 Answers0