WooCommerce is a popular WordPress platform that allows you to set up your online store for free in minutes. Installing the WooCommerce plugin allows you to enter thousands of products and receive numerous customer orders. Of course, after launching the store, you cannot leave the site alone. As the site administrator, you need to manage the orders and products of your store. One of your most essential needs after launching an e-commerce site is the bulk deletion of orders, especially when you receive a large volume of orders.
If you have a large store where hundreds of orders are registered daily, installing the WooCommerce bulk orders edit plugin is the easiest way to manage orders. However, bulk deletion of orders is possible in different ways in WooCommerce, which we explain in detail in this article.
First method: Remove all WooCommerce orders with SQL
To delete orders with SQL queries, you must first log in to your phpMyAdmin to access your site’s database. To enter the database through phpMyAdmin, you must access the website’s cPanel. After logging in, you must click on phpMyAdmin.
After logging into phpMyAdmin, you need to find your website database.
Depending on your WordPress database, the desired table can have different prefixes, but it is “wp_” by default.
After selecting your site’s database, go to the SQL tab. In this section, you can enter the following codes in the query for bulk deletion of orders.
Important Note: If you want to use the SQL method to bulk remove WooCommerce orders, backup your database before running the codes.
WooCommerce remove all orders and move to trash
To remove all WooCommerce orders and move them to trash using this SQL code:
UPDATE wp_posts SET post_status = 'trash' WHERE post_type = 'shop_order';
After entering this code, click the Go button to move all orders to trash.
If you want to delete orders permanently, you must enter the WordPress dashboard and go to the following path:
WooCommerce > Order > Trash
Then delete them forever by selecting all orders and the Delete Permanently option.
Bulk delete all from trashed WooCommerce orders permanently
If you want to permanently delete all your WooCommerce trashed orders, use this SQL code:
DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'product' AND post_status = 'trash' );
DELETE FROM wp_posts WHERE post_type = 'product' AND post_status = 'trash';
Bulk delete WooCommerce orders based on status
To delete orders that have a special status, you can enter the following code:
UPDATE wp_posts SET post_status = 'trash' WHERE post_type = 'shop_order' AND post_status = 'wc-completed'
By entering this code in the SQL query, only orders in Complete status will be moved to Trash. To remove other statuses, you can copy the following values instead of ‘wc-completed’:
If you want to delete orders that have different statuses at the same time, you can use the following code:
SET post_status = 'trash'
WHERE post_type = 'shop_order'
AND post_status IN ('wc-pending', 'wc-processing', 'wc-on-hold', 'wc-cancelled', 'wc-refunded', 'wc-failed')
Bulk delete all WooCommerce order notes
By entering the following code, all WooCommerce order notes will be deleted:
DELETE FROM wp_commentmeta WHERE comment_id IN ( SELECT ID FROM wp_comments WHERE comment_type = 'order_note' );
DELETE FROM wp_comments WHERE comment_type = 'order_note';
Tip: If the prefix for your WordPress tables was not wp_, you must replace it with your tables prefix in all the above codes.
For example, as you can see in the image below, the prefix of this site is “apos_”:
Therefore, to remove all orders at once from this site, the following code is entered in the SQL query:
Here is the code:
DELETE FROM wp_woocommerce_order_itemmeta;
DELETE FROM wp_woocommerce_order_items;
DELETE FROM wp_comments WHERE comment_type = 'order_note';
DELETE FROM wp_postmeta WHERE post_id IN ( SELECT ID FROM wp_posts WHERE post_type = 'shop_order' );
DELETE FROM wp_posts WHERE post_type = 'shop_order';
If you are not familiar with coding, it is better to use the following two methods to bulk delete orders.
Second method: Default WooCommerce bulk delete orders
Another method to delete bulk orders is using the WooCommerce default options. Although these options can make managing orders easier, they also have limitations. These limitations will convince you that installing the WooCommerce bulk orders edit pro plugin is the best way to manage orders.
To bulk delete orders WooCommerce plugin, you must go through the following steps:
First step: filtering WooCommerce orders based on status, user, and date
To bulk delete WooCommerce orders, you must enter the WordPress dashboard and go to the following path:
WooCommerce > Orders
As shown in the image below, a table of all orders will be displayed to you. To bulk delete the orders using the default WooCommerce orders list, you can first filter them:
Filter orders based on status
As shown in the image below, you can see the order status at the top of the table. Just click on each status link to filter the orders based on status. For example, completed or pending payment.
After selecting the desired status, the filtered orders will be displayed in the table.
For example, if you select Completed, you will see all completed orders in the table.
To bulk delete these orders, click on the checkbox next to the orders column to select all orders, then delete them, as we explain at the end.
Filter orders by date
You can also filter WooCommerce orders by date. At the top of the orders table, you will see a combo box related to the date.
You will get a drop-down menu of orders based on month and year by clicking this box. Then you can click on a specific month. In the example above, the month of November 2021 is selected.
When you click on the Filter button, only the orders of the selected month will be displayed in the table, and you can perform bulk deletion by selecting them again.
Filter WooCommerce orders based on registered customers
Another way to filter orders in WooCommerce’s default options is the name of customers who have registered in your WooCommerce store.
You can type the customer’s name in the Filtered by registered customer field. Then click on the Filter button. After that, you can see all the orders registered by the desired customer in the table.
Second step: Set the number of orders in the WooCommerce table
By default, WooCommerce lists 25 orders in the orders table, so you can delete only 25 orders by clicking the bulk delete option.
However, if orders exceed 25, you can go to Screen options and enter the desired number in the Number of items per page field. You can increase this number to 999; for example, if you enter 500, up to 500 orders will be displayed on one page of the WooCommerce orders table. You can select all of them and delete them in bulk.
Third step: Bulk delete WooCommerce orders and move them to the trash
After selecting the orders, you want to bulk delete, select the Move to Trash option from the Bulk actions drop-down. Then click on the Apply button.
Note: This will not permanently delete the orders but move them to the trash.
Fourth step: Remove WooCommerce orders from the trash permanently
To permanently delete orders, go to Trash and select all the orders you want to delete. Finally, click on Delete Permanently from the drop-down menu.
Finally, click on the “Apply” button.
You can also click on the Empty trash button to permanently delete all orders in the trash.
According to the explanations, you must have noticed that the bulk deletion of orders with WooCommerce default options has many limitations, including:
- It is impossible to filter based on all order fields, such as product, shipping method, payment method, etc.
- It is not possible to filter orders in combination. For example, you cannot filter orders for a specific product in a particular period.
- Filtering and bulk delete processes are very long, and deleting selected orders takes a lot of time from the store manager.
If you also face these problems in bulk editing WooCommerce orders, we suggest you install the WooCommerce bulk edit orders plugin and use its great features to manage orders.
In the following, we will try to delete WooCommerce orders using this plugin.
Third method: Bulk delete WooCommerce orders using a plugin
Bulk deletion of orders is done very quickly and easily with the WooCommerce orders bulk edit plugin. In this plugin, various methods are considered for the bulk deletion of orders. So the site manager can delete the desired orders in bulk without any restrictions in less than a few minutes.
First method: Bulk delete all WooCommerce orders with one click
If you want to delete all the orders on WooCommerce at once, click on the plugin’s trash button and select delete all. This quick and easy method moves all orders to trash with one click.
Second method: Filter WooCommerce orders, then bulk delete
Filtering and deleting orders is possible in the WooCommerce bulk orders edit plugin. A filter form is designed in this plugin that allows you to filter orders based on all the fields available in WooCommerce orders, including default fields and meta fields:
- Order ID
- Customer name
- Billing Address
- Product category
- Shipping address
- Order date
- So on
For example, as shown in the image below, to filter WooCommerce orders in a specific time frame and based on several specific statuses, enter the General tab in the filter form and proceed as follows:
- In the Date field, we specify the desired period using the internal calendar designed for the plugin.
- Select the options from the displayed list in the Status field.
You can use any other type of filter in combination with this form, and there is no limit for filtering WooCommerce orders in bulk orders edit pro plugin.
After filtering the orders, click on the Get orders button, so that the orders are filtered according to your request and displayed in the table.
First, select all orders for bulk deletion by activating the check box next to the ID column.
Then click on the trash icon and choose one of the following options:
- Move to trash: Selected orders are moved to trash.
- Permanently: Selected orders are permanently deleted.
If you select the Move to trash option, you can delete orders permanently later. For this, you must go to Trash by selecting Status in the search bar. Then select deleted orders and delete them by choosing the permanent option.
Restore deleted WooCommerce orders from history
Also, if you have a mistake in deleting the orders, you can enter the plugin History tab and restore the orders by clicking the Revert button.
Note: If you choose the permanent option, it is impossible to return the orders, and orders will be deleted from your site forever.
The third method: Filter WooCommerce orders, then export
Another method to bulk delete WooCommerce orders in the bulk orders edit plugin is to export the orders data and edit them using Excel software. In this plugin, there is the ability to import/export orders in CSV format. Therefore, you can get a CSV output from them after filtering the orders, then delete the orders with Excel software from the downloaded file, and finally import the CSV file through the plugin.
Read the tutorial on how to import/export CSV files through the WooCommerce bulk orders edit pro plugin in the link below:
Bulk delete orders from WooCommerce with the WooCommerce orders bulk edit plugin makes order management much easier. In addition to filtering and deleting orders, you can use this plugin as a helpful plugin for bulk editing all WooCommerce order fields.