Taxes are never fun, whether you're paying or collecting them. 

However, when you're running an eCommerce store with Magento, Taxes are an unavoidable headache.

We're going to try to explain everything in plain English, but there's no getting around the fact that taxes are hard work.

So, sit down in a comfortable chair and make yourself a strong cup of coffee. Let's explore how taxes work in Magento.

This guide is taken from Magento 2 Explained, the best-selling book for Magento 2. We use the example of a store called "Orangeville" in that book, so you'll see it referred to here.

Video Guide to Magento Taxes

E-Commerce and Sales Tax Explained

There's really only one kind of tax that e-commerce stores charge: sales tax.

Sales tax rates are different in every country. For example, if we run our company from Florida, we need to collect 6% sales tax, at least on some products. In California, the sales tax is 8.25%. In the UK, sales tax is 17.5%. In Spain, it is 18% and in Denmark, the rate is 25%.

The name also changes from country to country. In many European countries, the sales tax is called VAT (Value Added Tax). In Canada and Australia, the sales tax is called GST (Goods and Services Tax). In Japan, sales tax is know as a consumption tax.

The name of the tax, the rate, and the surrounding rules will be different depending on where you are.

But, at the end of the day, we're all talking about the same thing. If you run an e-commerce store, you may well need to collect sales tax from your customers.

That's what this chapter is about. How do we calculate the right amount of sales tax to add to different transactions?

The Basics of Magento Taxes

If you buy a product from a Magento store, the sales tax you pay depends on "Tax Rules".

  • Go to "Stores", and then "Tax Rules". You'll see this screen below:

Magento taxes rules screen

You will see that this screen is completely empty. We have no Tax Rules at all, so customers in our store will never pay any sales taxes. That's wonderful, right?

Unfortunately, that ideal setup would never last in the real world, at least if you want to stay out of prison.

So the focus of this chapter is on creating Tax Rules.

This is where it gets a little complicated, because Tax Rules consist of several different items. The image below shows the two different features that combine to create Tax Rules:

  • Tax Classes: these determine whether you need to be taxed.
  • Tax Rates: these determine the rate you may need to pay.

In this chapter, we're going to explain Tax Classes first, and then we'll tackle Tax Rates.

magento taxes

Tax Classes in Magento Explained

Tax Classes do not deal with money at all. Tax Classes simply answer whether you need to charge tax for the transaction.

Tax Classes can be assigned to shipping, products and customers:

  1. Shipping:  It's possible that your location requires that you add sales tax to shipping. This is true in over 30 states in the USA. Say you sold a $10 T-Shirt and charged $10 in shipping charges. In a state where shipping charges are taxable, the total taxable sale is $20, rather than only $10.
  2. Product: It's possible that some products have a different sales tax rate. For example, in many locations, physical products require sales tax, but services do not.
  3. Customer: It's possible that some groups of customers have a different sales tax rate. For example, in many locations, ordinary (retail) customers are taxed, but wholesale customers are not.

Here's how to find those three options inside Magento's configuration:

  • Go to "Stores", and then "Configuration".
  • Go to "Sales", and then "Tax" in the left-side menu:

Magento sales tax menu

At the top of this screen, you'll see the settings for all three tax classes. These are the default tax settings in Magento:

  • Shipping:  No tax.
  • Product: "Taxable Goods" is the default, but we asked you to change this to "None" when creating products.
  • Customer: Retail Customer.

Mamgento tax classes

So, what does this mean when a customer buys a product? It means that Magento has to perform several layers of calculations:

  1. Shipping: If this product needs shipping, do we need to add tax?
  2. Products: Does this particular product need tax?
  3. Customers: You are in a particular group of customers. Do we need to charge tax for this group?

One of the things that makes taxes complicated is that you can't see them in action outside of the checkout. You can't see them until a particular customer has chosen a particular product to be shipped to a particular location.

Magento Tax Rates

This is where the government's accountants start to get excited. Tax Rates are Magento's way of collecting local sales taxes.

The Tax Classes are simply used to categorize the shipping, products and customers into "Taxable" or "Not Taxable".

The Tax Rate is where we explicitly define how much money should be collected.

Let's walk you through the process of setting up a tax rate.

  • Go to "Stores", and then "Tax Zones and Rates".
  • You'll notice that Magento already has two default Tax Rates available for California and New York:

tax rates

We're going to imagine our Orangeville business is located in Florida. After all, Florida is famous for oranges and orange juice. We want to collect a 6% sales tax from everyone in Florida who buys our products.

  • Click "New Tax Rate".
  • Tax Identifier: Florida Sales Tax
  • Zip/Post Code: *
  • State: Florida
  • Country: United States
  • Rate Percent: 6.0

The Zip/Post Code option can be a little confusing. This allows you to set the tax for any Zip/Post Code that matches a certain pattern. For example, entering 9021* would cover all these zip codes: 90210, 90211, 90212, 90213, 90214, 90215, 90216, 90217, 90218, and 90219.

florida sales tax

  • Click "Save Rate" when you're finished.
  • You'll see that your Florida Tax Rate is now visible alongside two more tax rates: 8.25% in California and 8.375% in New York.

tax rate screen

Creating Your First Magento Tax Rule

So now we know the two key ingredients for setting up taxes in Magento: Tax Classes and Tax Rates.

Let's combine them into a Tax Rule that can actually be used during the checkout process on our store.

  • Go to "Stores", and then "Tax Rules".
  • Click "Add New Tax Rule".

We're going to set up a Tax Rule for the products that will be shipped from our Florida headquarters.

  • Name: Products That Need Shipping from Florida for Retail Customers
  • Tax Rate: Florida Sales Tax

florida retail

  • Click the "Additional Settings" tab.
  • Under these settings, you can see two of the Tax Classes: Customer and Product. We can leave these settings unchanged. If you did want to apply this Tax Rule to a different group of customers or products, you would change these settings.

customer tax class

  • Click "Save Rule".
  • You'll now see an overview of all the Tax Rules. This screen only has the Tax Rule you created, so the only customers who will pay tax are those from Florida. We will need to create more Tax Rules for other states and countries.

more Magento tax rules

Let's see this Tax Rule in action. First, let's turn one of our products into a taxable product.

  • Go to "Catalog", then "Products".
  • Edit the "Carrots" product.
  • Choose "Taxable Goods" as the "Tax Class".

Magento Taxes - edit tax class

Now let's buy some carrots and see if the tax is correctly added.

  • Go to the front of your site.
  • Sign in using your customer account.
  • Go to "My Account" and edit your shipping address. It doesn't matter what details you add, so long as you choose "Florida" for the "State/Province".
  • Click "Save Address".

Magento Taxes - edit address

Now let's go and buy some carrots and pay some tax!

  • Go to your store, and click "Add to Cart" for Carrots.
  • Click through the checkout process until you get to the "Review & Payments" page. On the right-hand side of the screen, you'll see that $0.06 has been added for sales tax.

Magento order summary

Summary of Magento Taxes

This first Tax Rule is a simple example, but hopefully it gives you a good introduction to how Magento taxes works. Tax Classes + Tax Rates = Tax Rules.

If you're ready to learn more about Magento, check out Magento 2 Explained, the best-selling book for Magento 2.


About the author

Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.