Search code examples
sqlwordpresswoocommerceproduct

Bulk change the tax status from all products in WooCommerce


I am changing my business type, which will not permit me to collect tax on products - ie, all products must be without tax.

So, with over 1200 products, how can I change the status from 'taxable' to not taxable ?

I have seen that the posts_meta table holds the tax status for each product - they are all set to "taxable", but I have not been able to find what it should be set to for not taxable.

I know that I can change the site to not charge tax (which I have done), but I want to clean up the product definitions to keep everything correct.

I am wanting to simply run the following command on the database :

update myshop_postmeta set meta_value = "???" where meta_key = "_tax_status"

After having replace the ??? with the right value.

Can anyone point me in the right direction, please ?


Solution

  • To bulk set all WooCommerce products tax status to "none", There are 2 related tables in the database to update (so 2 SQL queries):

    UPDATE wp_postmeta as pm  SET pm.meta_value = 'none'  WHERE pm.meta_key = '_tax_status';
    UPDATE wp_wc_product_meta_lookup as pml SET pml.tax_status = 'none';
    

    You should first check your database tables prefix (by default it is wp_)

    This is tested and perfectly works, using for example PhpMyAdmin.


    On WooCommerce Admin Products list, you could also use the "Bulk actions" to edit the tax status of multiple products at once.

    enter image description here

    enter image description here