Magento – Zero tax for those with valid VAT Number (maybe via customer groups)

magento2.1.5taxvat

I wish to charge zero tax if a customer has a valid VAT Number.

I can add a VAT Number to an address and I receive the message " Your VAT-ID was successfully validated. You will not be charged tax.". But tax is still added to the cart.

I have also used Configuration > Customers > Customer Configuration > Create New Account Options > Enable Automatic Assignment to Customer Group which allows me to assign a customer to a different Customer Group if their VAT Number is verified. But from this, I can't find a combination of settings to achieve zero tax for that group and 20% tax for the General group.

I'm on Magento 2.1.5. Ideas welcome!

Best Answer

The trick is:

  1. Create two tax rates, one at your normal rate and one at zero.
  2. Create two tax rules, one for taxable and for zero tax, these make use of the rates from step 1. As you create these, under Additional Settings, create, edit or assign Customer Tax Classes for each. In my case, I had Retail Customer ticked for the taxable rule and a new class, Tax-Exempt, for the zero Tax rule.
  3. In Stores > Customer Groups make sure there are two groups, one of which will have the taxable class you created in step 2 and the other will have the tax-exempt class.
  4. You can then enable Configuration > Customers > Customer Configuration > Create New Account Options > Enable Automatic Assignment to Customer Group to make the automatic customer group assignment happen.

HOWEVER, it didn't work for me, and here's why...

Long-ish story but it all boiled down to an "incorrect" VAT Number in Configuration > General > General > Store Information > VAT Number.

The client had provided this in the format NLXXXXXXXXXXXX so this is what was stored. In my case this was what was happening:

  1. The customer refreshes the cart
  2. The background lookup to check customer VAT Number is rejected by the remote service because the store's VAT Number NLXXXXXXXXXXXX (which is also sent) is not valid
  3. Magento takes this to mean customer VAT Number must be invalid
  4. The Automatic Assignment to Customer Group kicks in and sets my quote table record to the General group (note the customer_entity Customer Group is not changed)
  5. Tax is therefore always added on

One odd thing - and an annoying red herring - is that the store's VAT Number is NOT sent to the lookup service when I update addresses in My Address Book.

I guess the store VAT Number must be optional with the lookup service... hence I got a positive response and hence, "Your VAT-ID was successfully validated. You will not be charged tax".

In a nutshell, make sure your store's VAT Number does not include a country prefix. When you enter it in Configuration > General > General > Store Information > VAT Number, there is a handy "Validate VAT Number" button that clearly wasn't clicked in my case!