Magento2 EXCL/INCL VAT switcher

I need to create a VAT switcher in Magento2 where on click of the button product prices in the entire site get changed.

  1. When clicked on EXCL VAT all product prices VAT gets removed
  2. When clicked on INCL VAT all product prices VAT gets added

Also, what ever is the price of product at that time EXCL or INCL VAT, same also goes to add to cart

Any suggestions will be appricated.


1 Answer 1


I would first setup the config so that both prices (inc VAT and ex VAT) show. Then, I would keep the customer preference using a uicomponent that sets an observable.

finally, the uicomponent would hide either inc or ex VAT from the observable from above.

enter image description here

  • Thanks for response. Didn't get you fully. I have created a link in header & then on click either Incl or excl vat in entire site. This is something I am trying to achieve. Big question how to manage customer vice
    – Arjun
    Apr 5, 2021 at 16:42
  • Hi @Arjun , I need same thing but dont want by customer. can you please share me how you achieve this. kindly help me.
    – Ravi Varma
    Apr 28, 2021 at 9:46
  • hi @RaviVarma i did it by adding display none & block for the classes. Excl & incl class
    – Arjun
    Apr 29, 2021 at 5:40
  • Hi @Arjun bhai, I did same yesterday by display none and show on change dropdown and displayed to price. for block classes , can you help me with code or example. Thanks in advance
    – Ravi Varma
    Apr 29, 2021 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.