0
votes

A client is running an online shop with Wordpress and WooCommerce. Now as their shop grew bigger and the need for more development grew I wanna setup a staging shop for a better and safer workflow. I did a backup of the production shop but I'm wondering how can I remove all order data fast, safe and without notifying the customers to get a production-customer free staging shop with all the products still available.

I found define ('WC_REMOVE_ALL_DATA', true); but that will remove products aswell.

1

1 Answers

0
votes

There are couple of ways for deleting the WooCommerce orders. You can follow the convenient way. No email notification will be sent to the customer.

Method 1: Use this plugin - WC Delete all orders.

Method 2: Go to 'Orders' screen, select (check) all orders and choose Move to Trash from 'Bulk Options' dropdown. Click on 'Trash' and click Empty Trash button.

Method 3: Add this to your theme's 'functions.php', run only once and remove.

global $wpdb;
$wpdb->query("UPDATE $wpdb->posts SET post_status = 'trash' WHERE post_type = 'shop_order'");

Now all of your orders will be moved to trash and you can delete all by clicking Empty Trash button.