There are legitimate reasons to want to take WooCommerce out of a WordPress site (maybe you’re migrating it to its own subdomain, we do this a lot for our clients), and, when you’ve got rid of it, you want to take out all the extra information (products, orders, custom post types, etc etc) from the database because, well, its just a lot of cruft you don’t need if you are completely removing WooCommerce.
Luckily for you, the developers who helped to build WooCommerce had your best interests in mind when they created the plugin, and provided a nice way to simply clean out your database when you remove WooCommerce, by following the simple steps below.
How to Uninstall and completely remove WooCommerce
- Open your WordPress install’s
wp-config.php
file - Right before where it says “* That’s all, stop editing! Happy blogging. */” insert a new line, and add the following code
define ('WC_REMOVE_ALL_DATA', true);
– then save your file; - Deactivate WooCommerce at WP-admin > plugins
- Delete WooCommerce at WP-admin > plugins
- That’s it!
You’ll find, after adding the constant, that WooCommerce removes all its old data. I’d recommend to backup your database and files before doing anything like this. Or, consult a good developer and have them do it for you. Contact us to see about WordPress & WooCommerce development on your site.
Will Anything be Left Behind?
Maybe, is the answer. Isn’t it always! You may find that WooCommerce Extensions, or certain WooCommerce content is left behind even after completely uninstalling in this way. An example of this may be items in the wp_options database.
If you are in this situation, and you’d like your WordPress Database cleaned up after removing WooCommerce, please contact us. This is something we’ve done before, and usually in a few hours, we can have your WP site looking spick and span, and loading a lot faster. We’re also experts at optimizing WordPress (with or without WooCommerce) so we’ll be able to point you in the right direction of more performance.
Note to all WP Plugin Developers
Please follow suit, and allow the option to remove all the tables, wp_options and other elements your plugin (or theme) might have added to a WordPress webmaster’s database. Its nice to clean up after yourself. Polite, even.
what about after you uninstalled woocommerce?
If you already uninstalled without this in place, install and reactivate WooCommerce, add (or keep) the wp-config.php line, then deactivate and delete AGAIN. This will take out the WooCommerce tables, data and etc.
I have tried your method but WP start giving HTTP ERROR 500 on both back & front end.
You will be able to see from your error logs where you went wrong – most likely a missing “;” or some other typo in the wp-config.php file you just updated. Try again. Good luck!
I don’t use infusionsoft anymore so I would like to move away from infusedwoo to the regular Woocommerce
What is is the best way to do that?
I’m not that familiar with infusedwoo at all – but I would usually recommend to do a “clean install” and importing your products and orders across to the new clean site – there’s benefits to doing this even moving Woo to Woo as you drop a lot of old table cruft in the database which lingers around from every plugin or theme you installed. Consider this leaving the baggage behind!
If you’d like us to help with this please contact us.
Hi,
thanks for sharing this.
I once installed Woocommerce on my web site. Then removed.
I still see “https://mysite.com/page/71/?orderby=price” URLs in Google search console.
Would this modification in wp-config.php remove also all these leftover parameters from the URLs?
Thank you again
Cheers
Hugo
Thanks for sharing, saved me going through the BS of installing CLI for a simple fix.
if this method remove all data, removes products images too? I hope, you say yes
Hi,
What about manual database cleanup? Do you have a list or a query to clean all woocommerce tables? especially in wp_options… 🙂
Maybe you try Phpmyadmin if you have full control over it, and search any Prefixes related to Woocommerce.