Include and Exclude VAT Tax on Variable Products – Woocommerce

Sometimes we need to display details about include and exclude vat tax on variable products.
Today one of my client want to addinclude and exclude vat tax on variable products.

I was searching on the internet to find a function to apply theinclude and exclude vat tax on variable products. I found a helpful function here www.codehaven.co.uk

add_filter( 'woocommerce_available_variation', 'my_variation', 10, 3);
function my_variation( $data, $product, $variation ) {
    $data['price_html'] = "<span class='ex-vat-price'>ex. " . woocommerce_price($variation->get_price_excluding_tax()) . "</span><br>";
    $data['price_html'] .= "<span class='inc-vat-price'>inc. " . woocommerce_price($variation->get_price_including_tax()) . "</span>";
    return $data;
}

Just add this code to the bottom of your functions.php file and you are done.

Check out my other woocommerce related posts.

If you find this post helpful you pls write a comment.

Leave a Comment

Your email address will not be published. Required fields are marked *

0 Shares
Tweet
Share
Pin
Share