How to Reset Woocommerce data after uninstall? - Woocommerce Snippets

1 min read
How to Reset Woocommerce data after uninstall? - Woocommerce Snippets

So, You want to reset and delete WooCommerce data?

You probably tried to do it by manually deleteing products, orders and everything else page by page.

The only problem is deleteing everything manually is a bloody time-consuming process and you might end up wasting hours.

And, after uninstalling the plugin from WordPress directory and, deleting the WooCommerce plugin from WordPress as you do with any other plugin, you only remove the plugin and its files.

Your settings, orders, products, pages, etc… will still exist in the database.

In this tutorial, I will show you how to just do that in under 2 minutes.

Delete Woocommerce Data Completely

If you need to remove ALL WooCommerce data, including products, order history, reports, etc., you need to be able to modify the site’s wp-config.php file to set a constant as true.

To do that you need to add the following code snippet to your site’s wp-config.php file.

define('WC_REMOVE_ALL_DATA', true);
Please make sure add the above snippet on its own line above the /* That’s all, stop editing! Happy blogging. */ line.

After this, you can simply deactivate and delete the plugin and once you remove the WooComerce plugin from your website it will reset and delete WooCommerce related tables from your database which means it will delete all the products, orders history, woocommerce related pages and pretty much everything else.


🎉 You've successfully subscribed to NCY Design !