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?
At the moment you don't need to change a template anymore. You can set this in the Woocommerce settings:
WooCommerce v3.0.0 and Later
As of WooCommerce version 3.0, the function woocommerce_price() is deprecated, as is the the method get_price_including_tax(). Instead, you should use wc_get_price_including_tax:
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):Note: the
price.php
template that you modify should be located here inwp-content/themes/[your theme folder]/woocommerce/single-product/price.php
Update 2018/2019 (for Woocommerce 3+)
To display price without tax + tax amount + price including tax (on separated lines):
First read "How to override Woocommerce templates via your theme"
1) On
single-product/price.php
template file (single product pages).Replace the code with:
2) On
loop/price.php
template file (Shop and archive pages).Replace the code with:
Documentation:
• Template structure and how to override Woocommerce templates via your theme
•
wc_get_price_including_tax()
product price function•
wc_get_price_excluding_tax()
product price function•
wc_price()
formatting price function•
wc_get_price_to_display()
product price functionOriginal answer (before woocommerce 3):
Before check that your WooCommerce Tax general settings match with your needs.
As cale_b suggested, you need to copy from woocommerce the
templates
folder inside your active child theme or theme. Then rename itwoocommerce
. In thiswoocommerce
templates folder you will find insidesingle-product
subfolder the price.php template to edit related to pricing display in single product pages.In
single-product/price.php
template file just afterglobal $product;
, replace the code with:Because the additional prices are unformatted, you may need to mix some other elements with this additionals prices using some woocommerce php functions like:
Reference: WooCommerce WC_Product class