- PHP 7+
- PHP extensions ext-soap and ext-curl.
- SSH access to run commands as the web files owner.
You can install the module either with composer (recommended) or by FTP/SFTP transfer .
Composer Installation (recommended)
When you install the module with composer you can easily update the module with just one command. Get composer.
- Connect to the command line by SSH
- Change directory to your Magento root installation path
Type the following command and press enter
composer config repositories.geissweb composer https://packages.geissweb.de
Type the following command and press enter
composer require geissweb/module-euvat
Installation by FTP/SFTP
- Upload the contents of the .zip-Package (“app” folder) to your Magento root directory (“app”⇒“app”).
Finish the installation
You need to do this for all installation methods (Composer and FTP/SFTP).
Type the following commands and press enter
bin/magento module:enable Geissweb_Euvat
The installation procedure is now completed. The next step is to configure Magento for VAT and to configure the extension.
Updating the extension
Magento VAT Configuration
It is easy to use our automated setup in order to configure VAT for your country in your Magento installation. The setup will take care about creating the neccessary tax classes, tax rates and tax rules, as well as setting the required store configuration.
After successful installation, you should be able to see the setup notice in the admin area. To execute the setup, click on the “Configuration Helper” link. If you have already configured Magento for VAT, you can also skip the setup.
The following page will appear. Within this page, fill out the required fields with your data.
Explanation of the setup fields
- License Key: Your license key is visible in the downloads section of your customer account. Please use the same license key for all development and the production installation.
- Installation Type: If you installed the module in the production installation, select "Production".
- Domestic Country: Depending on the country selected, the tax rates and shipping origin will be configured.
- Merchant VAT Number : Required for extended VAT number validation with return of a request identifier.
- Apply store configuration for VAT : When enabled, the setup will set configuration values required for VAT calculation:
|Store config path||Value|
|Will be set to "Domestic Country"|
|general/store_information/merchant_vat_number||Will be set to "Merchant VAT Number"|
|tax/classes/shipping_tax_class||Will be set to the standard shipping tax class|
|tax/calculation/based_on||Will be set to "Shipping Address"|
|customer/create_account/auto_group_assign||Will be set to "No", this will disable Magento Core VAT validation.|
|customer/create_account/vat_frontend_visibility||Will be set to "Yes", shows the address based VAT number field in frontend.|
|customer/address/taxvat_show||Will be set to "No", will disable the account based Tax/VAT number field.|
- Create tax classes, rules and rates : This option can automatically set up all neccessary tax classes, rates and rules for VAT calculation. By default, it will create the rules for standard VAT calculation (at full rates of your country). Additionally, you can choose if you need further rules for example for electronic services or reduced products.
- Tax class mapping: To be able to provide an automated setup, the function needs to know the internal IDs of the product and customer tax classes. Therefore we will remove the existing tax classes from your system and create new ones. Make sure to select the mapping of the new IDs to fit your requirements. Existing products and customer groups will get the new IDs assigned, instead of the old ones.
Now just click on “Run Setup” to run the setup. If everything worked, you will be redirected to the extension configuration settings.
If you don't want to use the automated setup, this will guide you to the neccessary steps to setup EU VAT in Magento 2. As the interface for creating tax rules, classes and rates has been combined in Magento 2, we go through every (common) tax rule as follows:
Create tax rules
Navigate to “Stores → Tax Rules“, and create the tax rules like shown below. If you do not have to deal with products with reduced VAT rate (eg. food, books, ...) then you do not need create a tax rule for these type of products. The same is valid for digital products, you only need it if you deal with digital products selling to consumers where you need to calculate the VAT rate of the customer country.
Explanation of the tax rules
Imagine the point of view of a shop based in the Netherlands. The standard VAT rate in NL is 21%.
Consumers buy products with standard VAT: This is the basic standard rule required to calculate VAT for consumers. It applies to consumers and domestic businesses. For products and the shipping at standard rate, it will calculate 21% for each country listed in the tax rates section. For the tax rates, create one tax rate for each EU country with a rate of 21%.
Consumers buy products with reduced VAT: The same as above, just the product tax classes and tax rates change. For the tax rates, create one tax rate for each EU country with a rate of 6% (reduced VAT rate in NL).
Consumers buy digital products and services (MOSS rule for consumers): This rule is only needed if you sell digital content like downloads. It applies only to consumers, which should get calculated the VAT rate of their own country. For the tax rates, create one tax rate for each EU country with the standard rate of this country. For example: "AT digital VAT" has a rate of 21%, whereby "DE digital VAT" has a rate of 19%.
Domestic businesses buy digital products and services: As the MOSS rule is only applicable to consumers, domestic businesses should get calculated the standard rate of the domestic (merchant) country. The customer tax class is "Business incl. VAT" and for the tax rates, you can use the same rates as in the first rule (Consumers buy products with standard VAT).
EU Businesses buy VAT exempt: The last rule is for EU businesses with valid VAT number. It applies to "Businesses excl. VAT" with all possible product tax classes. Create one tax rate for each country with 0%.
Prepare customer groups
Navigate to “Stores → Customer Groups”. The use of customer groups is totally optional with the extension. The extension will dynamically apply the customer tax class depending on the customers VAT number validation results and the shipping address. The tax class of the customer group is just a fallback. Therefore it is optional if you want to assign customers to groups depending on the VAT number validation results, as the group and the tax class are not firmly connected anymore.
For reference, we suggest these customer groups:
Configuration of VAT in Magento
There are several places at the Magento system configuration where the calculation of VAT is affected. Following we go through each setting areas step by step.
Enable the VAT number input field
- Navigate to “Stores → Configuration → (Customers) Customer Configuration”
- At Create New Account Options set Enable Automatic Assignment to Customer Group to No, to disable the Magento core VAT validation
- At Create New Account Options set Show VAT Number on Frontend to Yes
- At Create New Account Options set your Default Group eg. General
- At Name and Address Options set Show Tax/VAT Number to No
Set the tax calculation method
- Navigate to “Stores → Configuration → (Sales) Tax”
- At Tax Classes set “Tax Class for Shipping“ to “Shipping with standard VAT rate”
- At Tax Classes set “Default Tax Class for Product“ to “Products with standard VAT rate”
- At Tax Classes set “Default Tax Class for Customer” to Consumers incl. VAT
- At Calculation Settings set “Tax Calculation Based On” to “Shipping Address”
- At Default Tax Destination Calculation set “Default Country” to your domestic (merchant) country
Set the shipping origin
This will define the origin country from where you ship the goods. It has to be your your domestic country.
- Navigate to “Stores → Configuration → (Sales) Shipping Settings”
- Set the shipping origin country
Now you have done all settings required in Magento for EU VAT calculation.
- License Key: Set your license key which you can find at your customer account at “My Downloadable Products”
- Installation Type: If this is your production installation, please select "Production".
- Debug Mode: Enable to get a detailed log file about the tax calculation flow. To get useful information from it, you should only log specific requests. For example put something in the cart and go to the cart page. Then delete the log file and reload the cart page. Then you have only the specific log for your cart. Otherwise all other calculations for example for the catalog pages are also included in the logs and as this log file will grow very fast in size, it becomes useless.
- Enable AJAX Validation: Will enable the AJAX VAT number validation. This setting has to be enabled in order to validate VAT numbers. Magento-like validation is not supported.
- Requester VAT number: Put the VAT number of the requester (eg. your own VAT number) in here. It will also be sent during a request to the interface which will return a request identifier which confirms that the requester validated the requested VAT number at a given point of time.
- Validation Interface: Which interface shall be used to validate the numbers. There is currently only "VIES" available.
- IPv6 Compatibility: If you have general problems to connect to the interface, the IPv6 compatibility mode might help. It depends on your server setup if you need this option. Turn it on and set your servers IPv4 address to see if the connection is working then. The request to the interface is bound to your IPv4 instead of your IPv6 if you enable it.
Dynamic VAT calculation
The module supports the dynamic descision whether or not to calculate VAT. It will consider the domestic country and the shipping (or billing) country and if the VAT number is valid or not. Based on the three tax classes possible, it will apply the class as configured.
- Use dynamic customer tax class: This setting will enable the custom VAT descision, based on the customer address instead of the customer group like Magento core does. When enabled, generally all customers can purchase without VAT, when their VAT number is valid and the country does match. They do not have to be assigned to a specific customer group anymore.
- Tax class consumer incl. VAT: This class will be applied when there is no VAT number on the customers address or if the VAT number is invalid.
- Tax class business incl. VAT: This class will be applied when there is a valid VAT number on the customers address and the country is the same as the domestic country configured.
- Tax class business excl. VAT: This class will be applied when there is a valid VAT number on the customers address and the country is different to the domestic country. This class will also be applied, when the country is not a EU member. EU member countries can be configured in the general store settings.
You can optionally disable certain groups from "being dynamic" in regards of the VAT calculation:
Also optionally, define countries where customers can not purchase without VAT even with a valid VAT number. It is not needed to select your domestic country here.
Cross Border Trade and Threshold Countries
If the main business of your shop is towards consumers, or for any other reason, you probably have set the admin prices to "Incl. Tax". Then you can choose to "Enable Cross Border Trade" at "Stores -> Configuration -> Tax".
If you do so then the business customers with valid VAT number will get the gross price, just without the tax amount. To calculate the real net price, enable "Disable Cross-Border-Trade (for valid VAT numbers)". Additionally you can control how you want to handle it for non-EU countries with the "Disable Cross-Border-Trade (for non EU)" setting.
Threshold countries: Sometimes you need to calculate the VAT rate of another country, when you sell to customers within that country. In this case you change the tax rate(s) for the country at "Stores -> Tax Zones and Rates" accordingly. Select such a country here to also calculate the actual net price with the foreign country rate, instead of the domestic rate.
Dynamic Shipping VAT
Currently the module supports two algorithms to calculate the shipping VAT dynamically.
- Largest Total: When set to "Use the tax class with largest total", the shipping tax class will have the same product tax class as the cart item with the biggest row total.
- Highest Rate: When set to "Use the tax class with the highest rate", the shipping tax class will have the same product tax class as the cart item with the highest rate.
Configure the additional tax classes for reduced and even super reduced rates if you need it.
It is optional to assign customer groups to customers based on the VAT number validation results. If you use it, you have to set all group assignments (leave none at -- Please Select --).
Choose the desired customer groups for the situations described in the configuration comments.
Overwrite actual customer group on guest orders: The customer group on orders from guests is usually "NOT LOGGED IN". If you want, for example for ERP integration, enable this setting to have a group set on the order according to the group assignment selection.
If you use the group assignment and need special groups for discounts, select these here at "Excluded groups". Customers in the selected groups will not be assigned to other groups based on the configuration above.
Change price display by customer group
These options give you a better control over how prices are displayed. In general when there is nothing configured it falls back to what is configured at "Stores -> Configuration -> Tax -> Price Display".
You can change the display individually for the catalog, cart items and the subtotal.
These options control how the VAT number input field behaves in the frontend.
- Enable Address fields on registration page: If enabled, the customer address input fields are shown at the registration, together with the VAT number input field. Your customers can register and will be assigned to the matching customer group, if group assignment is used.
- Field validation Options: Select which validation should apply for the customer registration, customer address edit and checkout fields.
- VAT number tooltip: A little help text, to guide your customers.
- VAT number field delay: This controls after how many seconds the validation of the number will start and show messages about the VAT number syntax and validity.
- Field visible countries: If you want to show the field only for specific countries, select them here. This field will only show countries, which are configured as "Allow Countries" at "Stores -> Configuration -> General".
- Ask customer to set the country automatically: A confirmation popup will be shown to the user and will ask to set the address country according to the VAT number prefix. This can help avoid mistakes if the user forgets to change the default country.
Periodic Revalidation of VAT numbers
When enabled the module will reuse existing VAT number validation data for the period selected. This has several benefits and is recommended. It lowers the amount of requests to the interface which can be overloaded or not responding at all. It is also faster to reuse the data instead of querying the interface again.
Congratulations! You should now have a well working default setup for your european VAT calculation needs. However as the module was developed based on requirements and wishes of its customers, we can not guarantee that this alone fulfils any national VAT requirements of your country.
We recommend to go through each use case together with your tax advisor.
Should you have any question, please create a support ticket from your customer account.