VAT breakdown on product page (4 posts)

  1. travellers
    Posted 3 years ago #

    On my single-product page I'd like to display the price as (for example):

    £10   (£8.33 plus VAT)

    I know by selecting 'Catalog prices defined including tax' under Settings>Tax>Catalog Prices I can change from a VAT-inclusive price to a VAT-exclusive one, but I want to show both prices. I found this chunk of code on stackoverflow which definitely includes the content I want, as if I include this whole piece on the page I get:

    From: £5.00
    Our Price: £6.00
    inc. VAT 20% (£1.00)

    But you can already see the problem - it's defined the inclusive and exclusive price on the page of the cheapest possible permutation, even before the customer has picked the permutation he wants. If he chooses the dearer option at £8.33, he still sees the 'wrong' price. Any idea on how I can REPLACE the price that's only shown once options have been chosen with this coding?


  2. travellers
    Posted 3 years ago #

    I have been looking at this (for HOURS!) and failed miserably. I have managed to fudge my way round it, for now at least, with the following:

    In ../woocommerce/classes/class-wc-product.php, change line 1524 from

    'price_html' 			=> $this->min_variation_price != $this->max_variation_price ? '<span class="price">' . $variation->get_price_html() . '</span>' : '',


    'price_html' 			=> $this->min_variation_price != $this->max_variation_price ? '<span class="price">' . $variation->get_price_html() . '</span><span style="font-size: 1.2em; font-weight: bold;"> + VAT </span><span style="font-style:italic">(where applicable)</span>' : '',

    I've absolutely no doubt whatsoever that this is the wrong and possibly a dangerous way to do this, but I needed some way of highlighting the VAT element and this is what I managed. Absolutely any help in doing it a more robust way would be hugely appreciated!

  3. aliput
    Posted 2 years ago #

    Hi Travellers. I looked for this file but I think woo commerce have changed since you created this post and I can't find it. Can't even find a folder called classes?

    Are you familiar with the new version of woo commerce (woocommerce3) and would you be able to help me out as I am having the same problem you had.


  4. thomasjojo
    Posted 2 years ago #

    the classes is in the Plugings folder: /plugins/woocommerce/

    I need help to find Where I can add my script to multiply the price with my taxrate, to show /and use/ in the shop.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic