How to Import Export Tax Rates in Magento 2
As everyone may know, tax rates vary according to geographic location. Though managing tax rates is not a big deal when you sell your products only in some specific countries, it can be a huge problem when your target customers are located worldwide. It is not hard to see that nobody can follow all customers orders to add tax rates or leave a tax rates field for customers to apply by themselves which is kind of tricky to find out and enter the right rate.
Therefore, Magento allows you to Import and Export tax rates for your convenience. To demonstrate you how to import/export tax rates in Magento 2.0, I will guide you to import a set of California tax rates that were downloaded from the Avalara website. In case you do not recognize the Avalara, it is a Magento Technology Partner who provides tax rate tables that can be downloaded at no charge for every ZIP code in the United States.
Export the Magento Tax Rate Data
- On the Admin sidebar, choose System > Data Transfer > Import/Export Tax Rates.
- Click Export Tax Rates, when there is a prompting box shown out, click Save.
- Look for the download file and open to view. Magento requires all text strings to be enclosed in double quotes while Microsoft Excel removes the double quotes, OpenOffice Calc is recommended to be used instead.
- Open the new tax rate data in an other spreadsheet and take note of any additional tax rate data that you might
need to set up in your store before the data is imported. For example, the tax rate data for California
includes:
- TaxRegionName
- CombinedRate
- StateRate
- CountyRate
- CityRate
- SpecialRate
- If you need to import additional tax zones and rates, you must first define them from the Admin of your store, and update the tax rules as needed then repeat the steps above.
Get the Import Data ready
- As you see, the default exported Magento tax rate data includes the following columns:
- Code
- Country
- State
- Zip/Post Code
- Rate
- Zip/Post Code is Range
- Range From
- Range To
- A column for each store view
Use cut and paste to rearrange the columns so they match the order of the Magento export data after inserting as many blank columns at the far left as needed to create a place to work in the spreadsheet with the new data.
- Rename the column headers to match the Magento export data.
- Delete the exceed columns that have no data to match with the original Magento export data structure.
- Before saving the file, Check the tax rate columns again to make sure that they contain only numeric data or the importing process will be prevented.
- Save the data as a .CSV file. When prompted, confirm that a comma is used a Field delimiter, and double quotes as the Text delimiter. Then, click OK.
Import the Tax Rates
- Return to you Magento admin, and here we go again. On the Admin sidebar, choose System > Data Transfer > Import/Export Tax Rates.
- Click Choose File, and choose the .CSV tax rate file that you prepared to import.
- Click Import Tax Rates. The importing may take some minutes to operate. After finishing, the system will inform you with “The tax rate has been imported”. You may also be promted that the process is error. Check the file again and fix the problem then try again.
- On the Admin sidebar, click Stores > Taxes > Tax Zones and Rates to show the imported rates list. Click to view the new tax rates.
- Test on storefront with different zip code to ensure the new tax rates work fine.