Display Woocommerce product price with and without tax and tax amount

Nuri Akman picture Nuri Akman · May 14, 2016 · Viewed 51.3k times · Source

I am using WooCommerce for WordPress and I'm listing items excluding Tax.

I need to show separately the Price (without tax), the Tax and the PRICE + Tax on the product page (like in checkout page).

I have not been able to find a plugin that does this.

How can I do this?

Answer

random_user_name picture random_user_name · May 14, 2016

WooCommerce v3.0.0 and Later
As of WooCommerce version 3.0, the function woocommerce_price() is deprecated, as is the method get_price_including_tax(). Instead, you should use wc_get_price_including_tax:

<?php echo wc_price( wc_get_price_including_tax( $product ) ); ?>

Prior to WooCommerce v3.0.0
You need to modify a template. Do not modify the core WooCommerce template, but rather make a copy of it to your theme, using the WooCommerce template override system. For help with that, refer to the WooCommerce docs on using the template override system.

In the price.php template, you will add this bit of code where you want the price, including tax (VAT):

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

Note: the price.php template that you modify should be located here in wp-content/themes/[your theme folder]/woocommerce/single-product/price.php