We don’t often write technical blog articles, but every now and then we come up against a problem and spend hours trying to find a fix for it, so we think it’s only fair we share that solution in case anyone else is having the same problem.
The problem we have this week was with WordPress (v4.2.2) and WooCommerce (v.2.3.13) when we were trying to set up VAT on products. Normally you’d go into WooCommerce settings, click Tax then enable the tax system and add in the standard tax rates. We noticed this week that it wasn’t working properly and in the basket and during checkout no tax was showing up at all.
We tracked down the problem eventually to the fact WooCommerce wasn’t creating a table in the database called wp_woocommerce_tax_rate_locations. When the site tried to work out where you were and what the tax rate was, the table didn’t exist therefore it wouldn’t show any results.
CREATE TABLE wp_woocommerce_tax_rate_locations ( location_id bigint(20) NOT NULL, location_code varchar(255) NOT NULL, tax_rate_id bigint(20) NOT NULL, location_type varchar(40) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
If you use phpMyAdmin or equivalent and run the SQL above, it will create the table for you. Go back into WooCommerce settings and re-save your tax configuration and it should populate the table and your issue will be fixed.
Hope that helps someone!
* Final working SQL code came from this link: http://pastebin.com/rVGcPpZ5