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!

Frequently asked questions

Can deleting all orders in WooCommerce affect my store’s sales reports, analytics, or financial records?

Yes, deleting all orders in WooCommerce can potentially affect your store’s sales reports, analytics, and financial records. When orders are deleted, corresponding data such as order totals, revenue, and sales tax information may be removed from your store’s records. This could impact the accuracy of sales reports or analytics tools that rely on order data to generate insights about your store’s performance. It’s essential to consider the implications of deleting orders and backup any necessary data before proceeding.

Are there any potential consequences or risks associated with deleting all orders in WooCommerce, such as data loss or irreversibility?

Yes, there are potential consequences and risks associated with deleting all orders in WooCommerce. Deleting orders removes valuable transactional data from your store, which could lead to data loss or irreversibility if not handled properly. Additionally, deleting orders may impact related data such as customer accounts, inventory levels, and financial records. It’s crucial to weigh the potential risks and consider alternative solutions, such as archiving orders or using order management tools, before deleting all orders.

Does deleting all orders in WooCommerce also remove associated customer data, such as order history or account information?

Deleting all orders in WooCommerce typically removes associated customer data, such as order history or account information, depending on your store’s settings and configurations. However, it’s essential to review your store’s privacy policy and comply with relevant data protection regulations when handling customer data. Consider notifying customers or obtaining consent before deleting their order history or account information to maintain transparency and trust.

Can I selectively delete orders based on specific criteria, such as order status or date range, rather than deleting all orders at once?

Yes, you can selectively delete orders in WooCommerce based on specific criteria such as order status or date range using various methods. For example, you can use the built-in order management features in WooCommerce to filter orders based on specific criteria and then delete them individually or in batches. Additionally, there are plugins available that offer advanced order management functionalities, including the ability to bulk delete orders based on custom filters or conditions.

How can I ensure that the process of deleting all orders in WooCommerce is completed safely and without causing any disruptions to my store’s functionality or performance?

To ensure that the process of deleting all orders in WooCommerce is completed safely and without causing disruptions to your store’s functionality or performance, it’s essential to follow best practices and take necessary precautions. First, backup your store’s data, including orders, customers, and settings, before proceeding with the deletion process. This ensures that you have a copy of your data in case anything goes wrong. Additionally, consider testing the deletion process in a staging or development environment before applying it to your live store. Finally, monitor the deletion process closely and be prepared to revert to a backup if needed to mitigate any issues or disruptions.

How to get started?

Learn more

WooCommerce Maintenance

Save 33% with our Annual pricing plan.

Get Started

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