The complete removal of WooCommerce and its data is not (or should not be) a common thing but it might be useful if you need to go back to previous version of WooCommerce or if just want to start from scratch or if you need to delete some test orders.

Here's a video how to do it.

If you deactivate WooCommerce and uninstall like you do with any other WordPress plugin this won’t delete the orders and customer data which makes sense otherwise lots of people would freak out.

The only extra step that needs to be done first before you attempt to uninstall WooCommerce is to edit your wp-config.php file and append one line.

You need to add this line right after the starting <?php tag.

define( 'WC_REMOVE_ALL_DATA', true);

To edit that file you will need to use an ftp client (e.g. FileZilla). Do make sure that the quotes are correctly pasted (e.g. single quotes look like single quotes) because if they aren’t this can/will crash your site. If you get an error you can manually delete the quotes around WC_REMOVE_ALL_DATA and type them again and upload the file.

Some may wonder why there isn’t a button that can be checked to confirm data deletion.

The problem is people don’t read and especially if they are tired or if they don’t know what they are doing they can click on the wrong checkbox and the order data would be lost.

Sometimes the user needs to be protected from themselves.

 

To recap the complete WooCommerce uninstallation steps

  1. Add the line in the wp-config.php to confirm that you really want the data removed
  2. Deactivate the WooCommerce plugin
  3. Uninstall the WooCommerce plugin
  4. Maybe reinstall WooCommerce plugin
  5. Remove the line from the wp-config.php in case you uninstall the plugin later.

 

Related

https://docs.woocommerce.com/document/installing-uninstalling-woocommerce/