Skip to content
Magento 2 · 11 min read

Setting Up VAT in Magento 2: Rates, Tax Rules and OSS

Tax configuration is one of the parts of Magento 2 that Italian merchants fear most, and with some reason: the system is powerful but designed for the US market, with names and concepts that don’t match how we think about VAT (IVA). When it’s configured badly, the result is prices that change between catalog and cart, VAT calculated twice, or invoices your accountant can’t reconcile.

In this guide I explain how to set up Italian VAT on Magento Open Source 2.4.x (and Mage-OS): tax classes, rates, tax rules, calculation settings, EU sales and B2B. One necessary premise: I handle the technical side. Which rate to apply and to which sales is something you decide with your accountant; here we look at how to turn those decisions into configuration.

1. How Magento thinks: classes, rates, rules

Magento calculates tax by combining three elements:

  • Product tax class: assigned to each product (the Tax Class attribute). Examples: “VAT 22%”, “VAT 10%”, “VAT 4%”.
  • Customer tax class: assigned to the customer group. Examples: “Individual”, “EU Company with VAT number”.
  • Tax rate: a percentage tied to a country, and optionally to a state/province and ZIP code.

The tax rule puts the three together: “for customers of this class, on products of this class, apply these rates”. If no rule matches the address for a given combination, Magento applies no tax. That’s a crucial detail, because it’s exactly how you get zero VAT where you need it.

2. Tax classes

Magento ships with a “Taxable Goods” product class and a “Retail Customer” customer class. I recommend renaming them or creating new ones with descriptive names. Classes are created directly from the tax rule form, in the Additional Settings section, where you can add, rename or delete them.

Then you assign the customer class to the groups in Customers → Customer Groups and the default classes in Stores → Configuration → Sales → Tax → Tax Classes: the class for shipping, and the default class for products and for customers.

3. Tax zones and rates

Rates are managed in Stores → Taxes → Tax Zones and Rates. For each one you enter an identifier, the country, optionally the state/province, the ZIP/postal code (* for all) and the percentage. For a store selling in Italy you typically need:

IdentifierCountryZIP/Postal CodeRate
IT-22Italy*22
IT-10Italy*10
IT-4Italy*4

Create only the rates you actually use: which products go at 10% or 4% is set by law, and for that you need your accountant.

4. Tax rules

In Stores → Taxes → Tax Rules you create one rule for each combination. For example:

  • VAT 22% Italy: rate IT-22, customer classes “Individual” and “IT Company”, product class “VAT 22%”.
  • VAT 10% Italy: rate IT-10, same customer classes, product class “VAT 10%”.

In the rule’s additional settings you’ll also find priority and sort order: if two rules have the same priority their rates are added together, while with different priorities they are applied one after the other. For Italian VAT, where only one rate applies to a product, the safest approach is to make sure each combination falls into a single rule.

5. Calculation and display settings

The most delicate part is in Stores → Configuration → Sales → Tax. This is the configuration I usually start from for an Italian B2C store, in line with the European example in the Adobe documentation:

SettingValue
Tax Calculation Method Based OnTotal
Tax Calculation Based OnShipping Address
Catalog PricesIncluding Tax
Shipping PricesIncluding Tax
Apply Customer TaxAfter Discount
Apply Discount On PricesIncluding Tax
Default Tax Destination Calculation → Default CountryItaly
Price display in catalog, cart and documentsIncluding Tax

The key point is consistency: if you enter prices with VAT included, declare it in Catalog Prices, otherwise Magento adds VAT on top of a price that already contains it. The default country is used to calculate the price shown when the customer hasn’t entered an address yet. If you sell to professionals, you can show prices excluding VAT in the catalog and the full breakdown in the cart, using the display sections for the cart and for orders, invoices and credit memos.

6. EU sales to consumers and OSS

Since July 1, 2021, distance sales of goods to consumers in other EU countries have a single EU-wide threshold of 10,000 euros: below the threshold you can keep applying Italian VAT, above it (or if you choose to do so earlier) the VAT of the customer’s country applies. The OSS (One-Stop-Shop) lets you declare and pay that VAT with a single quarterly return, without registering for VAT in every country. Assessing your case should be done with your accountant; on the Magento side there are two approaches:

  • Italian VAT across the whole EU: you create 22% rates for the other EU countries as well (or set the calculation on the shipping origin) and include them in the consumer rule.
  • Destination country VAT: you create a rate for each EU country you sell to, with that country’s rate, and attach them to the consumer rules. Each country’s rates change: check them periodically.

In the second case consider Enable Cross Border Trade: with VAT-inclusive prices, the final price stays the same in every country and only the VAT portion changes (and therefore your margin). Without it, the German or French customer sees a different price from the Italian one.

7. B2B with a VAT number and reverse charge

For sales to a company in another EU country with a valid VAT number, VAT is normally not charged on the invoice (reverse charge). Magento can automate this with VAT number validation through the European VIES service:

  1. In Stores → Configuration → General → General → Store Information enter the store’s country and VAT number and use the Validate VAT Number button.
  2. Create (or use the default ones) the customer groups for valid domestic VAT number, valid intra-EU VAT number, invalid VAT number and validation error, each with its own customer tax class.
  3. In Stores → Configuration → Customers → Customer Configuration → Create New Account Options set Enable Automatic Assignment to Customer Group to Yes, map the groups and, if needed, enable Show VAT Number on Storefront and Validate on Each Transaction.
  4. Create a tax rule for the “EU Company with VAT number” class with a 0% rate for EU countries other than Italy.
  5. Check the list of European Union countries in Stores → Configuration → General → General → Countries Options.

Two things to watch out for. Magento zeroes out the tax, but the reverse charge wording and the electronic invoice are the job of your invoicing system or ERP. And the Adobe documentation points out that with external checkouts such as PayPal Express, validation on each transaction doesn’t apply: keep that in mind when testing.

8. Importing tax rates

If you have many rates (typical with destination VAT), don’t enter them by hand: use System → Data Transfer → Import/Export Tax Rates. My advice is to export the file first, so you start from the exact header of your version, and then add the rows:

Code,Country,State,Zip/Post Code,Rate,Zip/Post is Range,Range From,Range To,default
IT-22,IT,*,*,22,,,,
IT-10,IT,*,*,10,,,,

After importing, remember to link the new rates to the tax rules: the import creates the rates, not the rules.

Checklist

  • Product and customer classes with clear names, assigned to products and groups.
  • The Italian rates you need and a single rule for each combination.
  • Catalog and shipping prices declared consistently (VAT included or excluded).
  • EU B2C strategy (Italian or destination VAT with OSS) decided with your accountant.
  • VAT number validation enabled if you sell to EU companies, with a 0% rule.
  • Test orders for every scenario: Italian consumer, EU consumer, Italian company, EU company, non-EU.

Tax configuration is something you do right once and then rarely touch, but it needs careful testing before going live. If you’d like a hand setting it up on your Magento, or checking it together with your accountant, write to me.

You might also like