Welcome to a Magento 2 Tax Tutorial. These series of posts aim to help you understand tax configuration within Magento, and how to configure the settings that best suit your store.
To help avoid confusion, any product prices will show both the excluding and including tax values. In addition, the tax rates that are included within Magento by default (US-CA-*-Rate 1 and US-NY-*-Rate 1), will be the ones used in examples in this post.
One of the key decisions to make when adding products to your store is if you choose to add the product prices including or excluding tax. This is an option that is configurable within the admin area under Stores -> Configuration -> Sales -> Tax
, expanding the Calculation Settings
section and changing the Catalog Prices
dropdown.
This post will assume that the option is set to Excluding Tax
.
Now expand the Price Display Settings
section, and set the Display Product Prices In Catalog
option to Including and Excluding Tax
. This will help us understand how tax is applied on the product pages.
Let’s start configuring a product. Here we will use a simple product that is assigned to the Taxable Goods
tax class. For simplicity, the product will also be priced at $100.
Viewing the product on the frontend should show that the price excluding and including tax should be the same.
This is expected behaviour as the tax rules have not configured yet within the admin.
To configure tax rules and rates, head to Stores -> Taxes
and first click on Tax Zones and Rates
. Here are where the two tax rates are configured, US-CA-*-Rate 1
and US-NY-*-Rate 1
.
So US-CA-*-Rate 1
should apply if the customer chooses United States of America
from the country dropdown, California
from the state dropdown and will have 8.25% added to subtotal, whereas US-NY-*-Rate 1
is applied to the New York
state, and will add 8.375%.
Tax Rules are made up of Tax Rates, and currently heading to Stores -> Taxes ->
, there are none configured.
Tax Rules
Click on Add New Tax Rule
and name the rule US Customer
. Choose the following configuration as seen in the screenshot below.
Save the rule, refresh the product page on the frontend of your store and you should notice that both the excluding and including tax prices remain at $100. This is because Magento hasn’t worked out which part of world the customer is trying to make a purchase from.
By heading to the checkout page, choosing United States of America
from the country dropdown, California
from the state dropdown and then going to the Payment and Review step on the checkout, you should notice that the US-CA-*-Rate 1
is applied.
This is how tax will be applied for guests who visit the website, as Magento will not be able to calculate the rate due to no shipping address present. This will also be true for registered customers that do not have a default billing and shipping address saved within their account.
If a customer has set a default billing and shipping address and Magento has recognised that their location matches the location in a tax rate, then Magento will correctly show the price including tax on the product page.
It should be noted that as the US-NY-*-Rate 1
tax rate percent has 3 decimal places (8.375), Magento will round this value up to 2 decimal places. So the test product in this example’s price including tax would be $108.38/
Why does Magento base the calculation from the shipping address? This happens due to a setting within the admin located under Stores -> Configuration -> Sales -> Tax
, expanding the Calculation Settings
section and viewing the Tax Calculation Based On
dropdown.
As you can see, the tax calculation setting can also be based on the Billing Address or the Shipping Origin.
The Shipping Origin setting can be configured under Stores -> Configuration -> Sales -> Shipping Settings
, and is needed when adding product prices within the admin including tax. Since we are not looking at product prices entered in the admin including tax in this post, configuring the Shipping Origin will be covered in future.
Some merchants may want a default tax calculation shown against products on the frontend, regardless of whether Magento knows the customer’s shipping address. There is a setting in Magento for this, known as the Default Tax Calculation Destination
and it is a setting that resides in Stores -> Configuration -> Sales -> Tax
.
Currently, Magento sets the Default Country
to United States
. As the asterisk wildcard is being used for the Default State
, Magento cannot choose between the two different tax rates for California and New York that are set up at the moment.
To use the US-CA-*-Rate 1
California rate, and therefore set the product prices to include this rate’s percentage on the frontend, simply set the Default State
to California
, save your changes and you should notice that even as you view the product on the frontend as a guest, the product’s including tax price will be $108.25.
This might seem like a strange approach for a merchant to take as different states have different tax rates, therefore a customer visiting the website from one state might be confused at why there are seeing a tax rate being applied from other.
More than likely, this option is for those that have set up a store based in the area that has a flat tax rate. For example, a store targeted specifically for UK customers may set up the product prices including tax to show the 20% tax rate on product pages, rather than wait to charge customers when they type in their shipping address on the checkout page.
That wraps up Part 1 of the Magento 2 Tax Tutorial. Proceed to Part 2.