Skip to the content
Documentation

User country

No ratings yet

With country dependent VAT, the VAT a customer pays depends on the customer's country. Exponential knows a user's country from an attribute of the Country datatype (ezcountry) in the user class, and asks for it at checkout. The list of countries and their properties is settings/country.ini; their names follow the locale of the siteaccess (see Translatable country names).

Adding the attribute to the user class

  1. Go to Setup > Classes, open the user class (in the class group Users) and press Edit.
  2. Choose Country in the list of datatypes at the bottom and add the attribute. Give it a name ("Country") and an identifier (country), and store the class.
  3. Name the identifier in the settings:
# settings/override/shop.ini.append.php
[VATSettings]
UserCountryAttribute=country

How a user gets a country

  • A new user chooses it in the registration form, when the attribute is part of it.
  • An administrator sets it when editing the user.
  • When a signed-in customer without a country gives one at checkout, it is stored in the user's attribute.
  • A site can let the visitor choose a country with the view shop/setusercountry (for example from a toolbar); it is stored as the preference user_preferred_country, which takes precedence over the attribute when the VAT is chosen.

With RequireUserCountry=true (shipped) the shop reports an error when the country is needed but not known. A VAT handler of your own that does not use the country can set it to false.

See Displaying VATs on the actual site for how the country chooses the VAT on product pages and at checkout.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.