Yesterday I was setting up a WordPress website with Woocommerce shopping cart for one of my customers. I went through the usual routine; setting up the customer location, the tax rates and creating a product in the store to test the settings. A while ago I created a CSV file that includes all Canadian Provincial tax rates, so it was just a matter of importing this file into the system and all rates do magically appear in the tax settings. How sweet!
Where’s the magic now?
Well, the Canadian tax was imported without a problem, also the tax button was switched on in the main settings panel and the product page was set up to have the proper tax calculation for each product. As I am living in North America, all our prices do not include tax, instead tax will be calculated on top of all products and services at the check out. So I went into the shopping cart and put the product in my basket. After that I went to the check out and as I was filling in the shipping address, I noticed something odd. Normally after selecting the Country and Province, the shopping cart system will calculate the tax automatically, based on the shipping address (if you have this option selected in the main settings). Guess what? No tax was calculated! Nothing, not even a zero amount.
Checking the settings
Wow, didn’t I drink enough coffee today, was I falling asleep, what did I overlook? Here’s a list of settings I checked to see what possible could have caused this problem:
Woocommerce settings panel:
- Is the Base store location properly filled out?
- Is the Currency set to Canadian dollars?
- In the tax tab, is the “enable taxes” selected?
- In the tax tab, how will tax be calculated, I want prices exclusive of tax.
- In the tax tab, I want the tax calculated based on the customers shipping address.
- In the tax tab, the shipping tax class is selected as based on cart items.
- In the tax tab, display prices in the shop and during cart and checkout excluding tax.
- In the tax tab, display tax totals as itemized. Switching to the selection “as a single total” gave me a zero rate in the cart, but we want itemized.
- In the tax tab, check the standard rates link and see if there’s a glitch in the tax tables. I even created an overall tax rate, not based on a Country or Province, to test if tax will be calculated this way.
- Going to the product, see if the tax status is set to “taxable” and the tax class is set to the same class as where I imported the Canadian tax rates, most likely this is the “Standard” tax class.
Back to basic with WordPress:
After checking all the settings in Woocommerce, I deactivated all plugins and switched to the Twenty-Fourteen WordPress theme. After that I went back to the store front and did a page refresh, but again, no tax was calculated.
After a rerun of the Woocommerce settings and deactivating and activating all plugins, I wondered if this tax problem could have something to do with the database. I browsed to the Woocommerce website and checked what tables should be installed during the setup. I logged in to the cpanel of the website and checked if all tables were listed in my WordPress database.
Then I noticed that the woocommerce_tax_rate_locations table was missing. Very interesting, a missing database table. I had to create this database table manually. In order to have the proper settings for this database I checked the settings on my own server and created the SQL file. So, if you have the same problem, now you know where to look at. And to make your life even more easy, here’s the mysql database file* that will install this table only in your database. After creating the database table, the tax system was up and running!
* Before implementing the missing table in your database, always make a backup of your database, so you can fall back in case something goes wrong. Edit: Good remark of Alex in the comments: Before implementing the database file, make sure you’ll change the prefix to match your database tables.[bctt tweet=”Tax didn’t show up in Woocommerce, this is how I fixed it. “]
Installing Woocommerce in WordPress is pretty straight forward in general. I don’t know why it wouldn’t install this particular database table, it could even be related to the version of Woocommerce. So if all store settings seem to be ok, but still no tax is calculated during checkout, check your database and compare it with the tables listed on the Woocommerce website. For every problem there’s a solution and the only thing I hope for is that you’ll come across this article before you’re pulling your hairs out to fix that tax problem on your website.