How to quickly delete all commands (orders) in WooCommerce [sql tips]

For various reasons, sometimes we need to We delete all orders data over time on a Magazine online (Orders) created with WooCommerce.

The handy method of all is to select a column of commands in “WooCommerce” → “Orders” , then to “Bulk Action” to choose the option “Move to Trash” si click “Apply“.

After we click on “Apply“, orders will be moved to “Trash“.

What do we do when we have several hundred or thousands of commands that we want to delete from WooCommerce Orders?

In the example above, I have only one order, but when there are some Hundreds of orders in Woocommerce, you have two variants by which you can delete them.

1. Woocommerce Orders deletion from Dashboard.

Many WordPress and WooCommerce users ignore or do not see that at the top, somewhere in the right Dashboard is the option “Screen Options”.

from “Screen Options” We can choose that a larger number of orders be listed on the page. By default Woocommerce lists 25 orders, but from “Screen Options” We can choose at “Number of items per page” a larger number.
If you have a very large number of orders, it is good though not exceed 150 orders listed on the page. You can do a very large Load at the server and communication interruptions may occur with the host server both on the controls and their deletion. Errori nginx or httpd server.

WooCommerce Number of Orders per page

After you click on “Apply” Refresh will automatically be given on the page and listed the number of WooCommerce Orders set by you.

2. WoCommerce delete delete from SQL

This method will move all commands in WooCommerceOrders in “Trash“, where you can delete them with a single click.

First of all you make a backup at the database.

Go to Phpmyadmin, select the store database, and in SQL execute the command line below:

update wp_posts set post_status = 'trash' where post_type = 'shop_order';

4347 rows affected. (Query took 0.2114 seconds.)

The result returned in my case.

After we successfully execute the order from SQL, we go to the online store in Dashboard → WooCommerce → Orders → Trash and Click on “Empty Trash“.

If you have to delete a large number of commands from the basket, do not expect them to disappear after a single click on “Empty Trash”. It is very likely that the web page does not respond and the server error that disappears after a refresh. Resume the operation until the trash can “Orders” It will be empty.

Passionate about technology, I write with pleasure on stealthsetts.com starting with 2006. I have a rich experience in operating systems: Macos, Windows and Linux, but also in programming languages ​​and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, Presashop).

Home Your source of IT tutorials, useful tips and news. How to quickly delete all commands (orders) in WooCommerce [sql tips]

5 thoughts on “How to quickly delete all commands (orders) in WooCommerce [sql tips]”

  1. But would it not be better to have a client database to be contacted?

    On my site the oldest orders are automatically canceled.
    How do I block this procedure instead and keep them forever?

    Thank you.

    Reply
Leave a Comment