The trick is:
- Create two tax rates, one at your normal rate and one at zero.
- 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.
- 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.
- 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:
- The customer refreshes the cart
- 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
- Magento takes this to mean customer VAT Number must be invalid
- 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)
- 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!