Your Dedicated Partner for All Things WordPress

How to Delete All Orders in WooCommerce

Table of Contents

Every now and then you will need to delete all orders from WooCommerce online stores. For instance, you have created a new WordPress website for your client and now you need to test whether the WooCommerce online store functionality works or not. You generate mock orders to see if everything works properly, but you have to delete them afterward. A small number of orders can be deleted manually, but for a large number of orders, this method would be especially time-consuming. Let us take a look at different techniques on how to delete WooCommerce orders.

Deleting WooCommerce Orders Manually

The most common approach is to delete all orders manually via your WordPress dashboard. It is a quick and efficient method when the amount of orders is low.

Start with locating the WooCommerce Orders panel in your WordPress dashboard. It is located in the WooCommerce dropdown menu. Click on it, so you would be re-directed to the main Orders window.

WooCommerce orders

By default, WooCommerce displays 25 orders per page. If the amount of orders in your case is higher, then locate the Screen Options tab in the upper right corner and click on it.

WooCommerce screen options

Set the Number of Items Per Page option accordingly, so it would display all your orders on a single page. Click the Apply button afterward to save changes.

Pagination

Now all orders can be seen on a single page and we can start deleting them. You can select all orders at once, by ticking the checkbox underneath the Bulk Actions window. If you want to select only specific orders, then you will have to tick each box manually. Keep in mind that you can apply filters to target specific clients or dates.

WooCommerce bulk actions delete order

When you have selected all orders that need to be deleted, then go back to the Bulk Actions window and select the Move to Thrash option. Click on the Apply window to confirm the action.

WooCommerce move to thrash

Bear in mind, that even though you moved orders to thrash, they are yet to be completely deleted. To remove them entirely, you will need to go to the Thrash and either select all orders via checkbox again and pick the Delete Permanently option in the Bulk Actions window, or just click on the Empty Thrash button next to the filter options.

delete permanently order WooCommerce

As you can see, manually deleting orders is rather straightforward. Remember to clear cache!

Deleting WooCommerce Orders via SQL

As we mentioned previously, it is highly inefficient to manually delete a large number of WooCommerce orders. In web development, wasting time manually ticking thousands of checkboxes is an inept way of accomplishing such a task.  Thankfully, the issue can be remedied via the use of code.

Login to your phpMyAdmin account. Before proceeding, confirm that the script will be run on the correct database. To ratify whether the correct database is loaded, look for the table wp_options and check if it has the correct URL for your website. Always backup your website before running any script! Otherwise, you may lose significant data or even render the website inaccessible. You should regularly take precautions when running advanced SQL queries.

myphpadmin sql panel

You have located the SQL panel and now it is time to apply the code below. If your database prefix is not wp_, then replace it with the prefix you are using. Press the Go button to execute the SQL statement.

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’;

Now all data associated with WooCommerce orders has been successfully deleted. Take note that even though we have cleared the database, there might be some leftover data. Every action influences the post metadata table and if you are not cautious, then you might end up with thousands of rows of data that is unused. By deleting orphaned post metadata (data that is affiliated with nonexistent posts), you will eliminate all records that have no use. In the same manner as before, run the following code.

DELETE pm

FROM wp_postmeta pm

LEFT JOIN wp_posts wp ON wp.ID = pm.post_id

WHERE wp.ID IS NULL;

After running this code, you can be sure that all data concerning orders and other useless data has been deleted. You should get a notification that SQL Query has been executed properly.

Deleting WooCommerce Orders via Plugins

If you are not savvy with coding and databases in general, then consider using plugins. Unfortunately, there are not many plugins that can delete all WooCommerce orders and their corresponding data. Although there are plugins that reset databases, not many of them have functionality for this specific task. Let us take a look at 3 popular plugins that can be used to delete all WooCommerce orders.

WP Reset. The most popular plugin for resetting sites databases to the default installation values without modifying files. It is a fast and efficient way of targeting specific data and removing it. With multiple fail-safe mechanisms integrated into the plugin, you will be able to restore any data you have accidentally deleted. We advise you to carefully take a look at the documentation in order to understand how to select and target the data you desire.

Store Toolkit for WooCommerce. This plugin includes a growing set of commonly-used WooCommerce administration tools, mainly, aimed at web developers and store maintainers. With a large set of maintenance/debugging/clearing tools at your disposal, you will be able to delete any data concerning WooCommerce.

Smart Manager for WooCommerce. For the most part, this plugin is used to increase WooCommerce functionality and add additional tools for managing your store, but it can be used to clear your database from unnecessary orders and their corresponding data. The plugin has a free(lite) version and a paid one.

If you need to delete other data than orders, then you can take a look at our previous articles. For instance, if you have the same issue with WooCommerce products, then take a look here.

Final Words

Sometimes, deleting WooCommerce data is not as straightforward as it seems. Even if you have deleted the WooCommerce order data from your dashboard, there might be some leftover data in your database. With these methods, you should be able to thoroughly clean your database. Keep in mind that it is up to you to decide which approach is better suited for your situation. We wish you a bug-free journey through the world of e-commerce and stay tuned for more articles!

How to get started?

Learn more

WooCommerce Maintenance

Save 33% with our Annual pricing plan.

Get Started

Looking for help? Chat with us.

Are you in need of assistance or guidance? Look no further! Our dedicated team is here and ready to help. Chat with us today and let’s work together to find the perfect solution for your needs.

Our support team will get you:

I believe every website owner deserves a reliable professional support always by their side.

Alexey Seryapin
Founder of WPServices

Having Troubles With WordPress?

Claim Your Free WordPress Maintenance

In today’s fast-paced digital landscape, every website deserves the care and expertise of a professional maintenance team, ensuring optimal performance, enhanced security, and seamless user experiences, so you can focus on growing your business with peace of mind.

Alexey Seryapin
Founder of WPServices

Coupon Code Applied!

Take your time and continue browsing our services.

Alexey Seryapin
Founder of WPServices