How to Delete WooCommerce Orders

Looking for the best way to delete WooCommerce orders? In this guide, we’ll show you various ways to remove the orders in your eCommerce store.

Before we look at how to do it, let’s get a better understanding of why you might need to delete the orders.

Why Delete Orders in WooCommerce?

As an eCommerce business owner, it’s always good to receive lots of orders. By default, you can manage orders with the help of order status and change them automatically. You can see which products are delivered or canceled along with refunded and failed status.

Due to all of these records, your database is loaded with lots of order data. Orders are also a post type which means that they are stored in the WordPress database. And even though WordPress doesn’t have any limits when it comes to users, posts, pages, and plugins, your hosting server definitely has a limitation.

Having a large database can affect the performance of your website because it takes more time for your server to receive the information from the database tables. This leads to slow loading websites and in most cases, your website may crash too.

Therefore it is very important to delete WooCommerce orders to clear up the database and maintain the optimal performance level of your website.

How to Delete WooCommerce Orders?

There are three main ways to delete WooCommerce:

  1. With the default WooCommerce options
  2. Using a Plugin
  3. Programmatically using SQL Query

Let’s check out each method in more detail.

1. Delete orders using Default WooCommerce Options

WooCommerce provides you with some default options to delete all kinds of orders in WooCommerce. First of all, let’s see how we can delete a single order in WooCommerce.

1.1)  Edit order Page

You can easily delete an order from the edit order page. Just go to WooCommerce > Order on your WordPress Dashboard. Here you can see all orders and their respective date and status.

Then, click on the order that you want to remove from your database and you will be redirected to the edit order page.

delete woocommerce orders

You can edit the date, change the order status, add notes and also add billing and shipping details of the customers on the edit order page. But to delete the WooCommerce order, you need to click on the Move to Trash link on the right side of your screen.

It will move the order to the trash.

delete-woocommerce-orders

However, the order is not completely deleted since it’s just in the trash. If you want to delete the order permanently, you have to remove it from the trash too.

So once again, go to WooCommerce > Orders and click on the Trash tab. Then, check the checkbox of the order that you want to remove completely and select Delete permanently in the bulk actions dropdown menu. Finally, click on Apply to remove the order permanently.

If you want to delete all the orders in the trash permanently, you can simply click on Empty Trash too.

remove from trash delete woocommerce orders

1.2) Bulk Delete Orders

Deleting a single order is quite easy. But it can be time-consuming if you have to delete multiple WooCommerce orders one by one.

But the default WooCommerce dashboard allows you to delete them in bulk too. You can even delete the orders according to their order status.

To do so, go to WooCommerce > Orders once again. If you have orders with different orders statuses like pending payment, processing, hold, completed, and so on, you can select them from the orders list.

Let’s suppose you want to delete all of the orders which have been completed. In that case, you can select the Completed status option.

There you can find all of the completed orders and a checkbox right next to it. You can click on the checkbox of Order which automatically selects all of the orders within the Completed status. So, instead of clicking the checkbox manually, this makes the matter easier and quicker.

Now, select the Move to Trash option from the bulk actions dropdown option and click on Apply. Remember that this doesn’t delete the order but move to the Trash.

delete woocommerce orders bulk actions

Again, to delete the orders permanently go to Trash and select all of the orders that you want to remove. Finally, click on the Delete Permanently option from the dropdown menu.

In the end, click on the “Apply” button.

As mentioned earlier, you can also click on Empty Trash to delete all the orders in the trash permanently.

1.3) Filter options (date/registered customers)

You can also delete WooCommerce orders with the filter options available on the WooCommerce Dashboard. You can find the filter option above your order list.

If you click on the All Dates you’ll get a dropdown menu of orders according to month and year. After that, all you need to do is click on particular month order. Here we have selected November 2021 orders.

delete woocommerce orders filter options

As you can see all of the orders along with the order status are displayed from the selected month. Just like the previous steps, we can select the orders and move them to trash, and later delete them permanently.

Similarly, we can also filter our orders using the registered customer option. You can type and search the name of the customers who are registered to your WooCommerce store. Then, click on the Filter button. After that, you can see all the orders of the registered customer that you want to delete.

Once again, we’ll repeat the process of deleting the orders and moving them to the trash. Then, we can finally delete them by emptying the trash.

That’s it! You have successfully deleted WooCommerce orders from the WooCommerce dashboard.

By default, WooCommerce lists 25 orders at a time which means you can select and delete only 25 orders from the orders page. Yes, you can delete more than 25 orders by changing the screen options. But it may take a lot of time to do it manually and you have to clean the trash to remove the orders permanently after that too.

Not only that, you’ll have the same request over and over again which may result in a server error. But to avoid these limitations, you can just use a dedicated plugin to delete WooCommerce orders.

2. Remove WooCommerce Orders using a Plugin

You can delete WooCommerce orders with the help of plugins as well. Many plugins can help you remove the orders in WooCommerce. But for this tutorial, we will show you how to delete WooCommerce orders using the Smart Manager for WooCommerce plugin.

As the name suggests, the plugin allows you to manage the WooCommerce post types in a very smart way. You can manage post types like orders, products, blog posts, coupons, and even manage any custom field of other plugins. These post types can even be filtered using the conditional search with the help of this plugin.

delete-woocommerce-orders

2.1) Install and Activate the Plugin

To start using the plugin, you need to install and activate it first. So go to Plugins > Add New from your WordPress dashboard and search for the plugin. Once the plugin is displayed, click on Install Now to install the plugin. After the installation is complete, Activate the plugin.

You can download and install the plugin manually if you want to use the premium version of the plugin. Please take a look at this guide on how to install WordPress plugins manually for more information on it.

2.2) Remove orders from Plugin Interface

The best part about this plugin is, you don’t need additional configuration and setup for it. Once the plugin is activated, you can just go to Smart Manager from your WordPress dashboard which will redirect you to the plugin dashboard.

On the topmost part, you can see the Navigation bar where you can select a post type using the dropdown option. Usually, the default post type is displayed as “Products” or “Posts”. You need to set this option to Orders.

delete woocommerce orders smart manager

 

Upon clicking on Orders, you can see all of the data of your WooCommerce order in a tabular form. If you need to filter the orders according to their order status, you can also enter your order status in the next option. Here, we have selected the Completed order status.

delete-woocommerce-orders

Now, you can start selecting the orders that you want to delete in the checkboxes. Just below the Navigation bar, you can see an Action bar from where you can Bulk Edit the data, print invoices for the orders, add records, and duplicate the delete and Export CSV.

While hovering on the Delete option, you’ll get two options either to delete the orders permanently or move the orders to trash. Choose your preferred option and the plugin will remove the orders accordingly.

2.3)  Remove Orders with Advanced Search and Conditions

Alternatively, you can delete an order with Advanced Search including conditions too. You can find the Advanced Search toggle on the Navigation Bar.

Enabling the toggle leads to a page where you can select the orders with several conditional options. This option is not available in the WooCommerce default dashboard.

Here, we have selected an order to be displayed with the order status as pending payment. Now select the order status from the dropdown menu and click on Search.

You will be able to see all the orders with the pending status in the results. Select the orders that you want to delete and remove them permanently or move them to the trash just like the previous step.

3. Delete WooCommerce Orders Programmatically – Using SQL query

We can see that using a dedicated plugin to delete WooCommerce orders is very quick and easy compared to the default WooCommerce options. But if you don’t want to add extra weight to your website by adding a plugin, then you can delete WooCommerce orders with a programmatic approach as well.

We will add SQL queries to your database to remove orders with this method. To access your database, you’ll need to log in to your phpMyAdmin. If you don’t have the credentials for phpMyadmin, you can access it via cPanel or contact your hosting provider.

Note: Make sure to always create a backup of your website and database before you edit the core files. This ensures that you can always restore your site and data in case something goes wrong. It’s also best if you try these SQL queries on a local host staging site first.

After you’ve logged in to phpMyAdmin, you need to find your website database.

Depending on your WordPress database, the table prefix can be different instead of “wp_”. By default, it is “wp_” which is also the same in our case. But if your table prefix is something else, replace “wp_” with your custom WordPress database prefix.

delete woocommerce orders phpmyadmin

 

Now go to the SQL tab and add the following snippet in the query section. and click on Go.

UPDATE wp_posts SET post_status = 'trash' WHERE post_type = 'shop_order';

You can execute this simple SQL command to move all orders to trash.

Once you move all of the orders to trash, make sure to go to WooCommerce > Order > Trash and remove the orders permanently. It’s the same as mentioned in the previous steps.

delete woocommerce orders empty trash

But if you have large orders and want to skip the trash, just add  --force to the end of the command.

wp post delete $(wp post list --post_type='shop-order' --format=ids) --force

To delete selected order with order status, you can update the snippets like this too:

UPDATE wp_posts SET post_status = 'trash' WHERE post_type = 'shop_order'AND post_status = 'wc-completed'

If you’d like to delete orders with a different status, here are the available options you can replace:

  • wc-completed
  • wc-pending
  • wc-processing
  • wc-on-hold
  • wc-cancelled
  • wc-refunded
  • wc-failed

Furthermore, if you want to just delete the orders according to multiple selected order status instead of all orders or just selected order status then, you can try this query instead:

UPDATE wp_posts
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')

You can use any of the SQL queries according to your needs. After saving each SQL query, go to your WordPress dashboard and see if the code works.

That’s it! This is how you can delete WooCommerce orders using SQL queries.

Bonus: How to Export Orders in WooCommerce

We have provided you with several methods to delete WooCommerce orders. However, deleting the orders might not always be what you want. Sometimes, you might need to export them too.

The easiest and the quickest way to export orders in WooCommerce is by using a dedicated plugin like Order Export & Order Import. Before we begin, let us remind you to set up WooCommerce in the correct way using one of the compatible WooCommerce themes to avoid any theme or plugin conflicts.

Let’s start by installing and activating the plugin. Go to your WordPress Dashboard > Plugins > Add New and search for Order Export & Order Import for WooCommerce in the search bar. Then click on the Install Now button and Activate it.

Upon activating you can see new settings have been added under WooCommerce in the sidebar.

You can export your customer order by configuring settings. For that go to WooCommerce > Order Im-Ex.


Once you are in the plugin configuration, you can choose the statuses and date ranges of the orders you want to export. Select the orders status, start date, and end date for your orders. Then, click on Export Orders.

Now, this plugin will extract your WooCommerce order data and create a custom CSV file. You can save the file to any location on your computer.

As you can see, it is very easy to export WooCommerce orders. If you want to learn more about exporting and importing WooCommerce orders with various other plugins then check out this article.

Conclusion

In summary, removing orders from your store helps you avoid the risks that come with an overloaded database. In this tutorial, we’ve seen three major ways to delete orders in WooCommerce:

  1. Dashboard
  2. With a plugin
  3. Programatically (SQL Query)

If you are looking for a quick and risk-free method then using a plugin is the best way to remove WooCommerce orders. But if you don’t want to use third-party tools and you are familiar with PHPMyAdmin, then you can also delete the WooCommerce orders by using SQL queries.

We have also mentioned a bonus section to export WooCommerce orders in this article. If you want to learn more about WooCommerce orders, we even have detailed guides to repeat WooCommerce orders, autocomplete orders using Autocomplete WooCommerce Orders, and even refund the orders.

Meanwhile, have a look at the following posts for more information related to database and WooCommerce orders:

If you found this article useful, share it with your friends via social media channels. Did you try any of the methods? If yes then share your experience in the comment section.