{"id":204105,"date":"2022-02-26T03:52:59","date_gmt":"2022-02-26T06:52:59","guid":{"rendered":"https:\/\/quadlayers.com\/?p=204105"},"modified":"2022-03-06T08:19:59","modified_gmt":"2022-03-06T11:19:59","slug":"delete-woocommerce-orders","status":"publish","type":"post","link":"https:\/\/quadlayers.com\/delete-woocommerce-orders\/","title":{"rendered":"How to Delete WooCommerce Orders"},"content":{"rendered":"

Looking for the best way to delete WooCommerce orders<\/strong>? In this guide, we\u2019ll show you various ways to remove the orders in your eCommerce store.<\/p>\n

Before we look at how to do it, let\u2019s get a better understanding of why you might need to delete the orders.<\/p>\n

Why Delete Orders in WooCommerce?<\/h2>\n

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<\/a>. You can see which products are delivered or canceled along with refunded and failed status.<\/p>\n

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

Having a large database can affect the performance of your website<\/strong> 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.<\/p>\n

Therefore it is very important to delete WooCommerce orders to clear up the database and maintain the optimal performance level of your website.<\/p>\n

How to Delete WooCommerce Orders?<\/strong><\/h2>\n

There are three main ways<\/strong> to delete WooCommerce:<\/p>\n

    \n
  1. With the default WooCommerce options<\/li>\n
  2. Using a Plugin<\/li>\n
  3. Programmatically using SQL Query<\/li>\n<\/ol>\n

    Let\u2019s check out each method in more detail.<\/p>\n

    1. Delete orders using Default WooCommerce Options<\/strong><\/h3>\n

    WooCommerce provides you with some default options to delete all kinds of orders in WooCommerce. First of all, let\u2019s see how we can delete a single order in WooCommerce.<\/p>\n

    1.1)\u00a0 Edit order Page<\/h4>\n

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

    Then, click on the order that you want to remove from your database and you will be redirected to the edit order page.<\/p>\n

    \"delete<\/a><\/p>\n

    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<\/strong> link on the right side of your screen.<\/p>\n

    It will move the order to the trash.<\/p>\n

    \"delete-woocommerce-orders\"<\/a><\/p>\n

    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.<\/p>\n

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

    If you want to delete all the orders in the trash permanently, you can simply click on Empty Trash<\/strong> too.<\/p>\n

    \"remove<\/a><\/p>\n

    1.2) Bulk Delete Orders<\/h4>\n

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

    But the default WooCommerce dashboard allows you to delete them in bulk too. You can even delete the orders according to their order status.<\/p>\n

    To do so, go to WooCommerce > Orders<\/strong> 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.<\/p>\n

    \"\"<\/a><\/p>\n

    Let\u2019s suppose you want to delete all of the orders which have been completed. In that case, you can select the Completed<\/strong> status option.<\/p>\n

    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.<\/p>\n

    \"\"<\/a><\/p>\n

    Now, select the Move to Trash<\/strong> option from the bulk actions dropdown option and click on Apply<\/strong>. Remember that this doesn\u2019t delete the order but move to the Trash.<\/p>\n

    \"delete<\/a><\/p>\n

    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<\/strong> option from the dropdown menu.<\/p>\n

    In the end, click on the \u201cApply<\/strong>\u201d button.<\/p>\n

    \"\"<\/p>\n

    As mentioned earlier, you can also click on Empty Trash<\/strong> to delete all the orders in the trash permanently.<\/p>\n

    1.3) Filter options (date\/registered customers)<\/h4>\n

    You can also delete WooCommerce orders with the filter options<\/strong> available on the WooCommerce Dashboard. You can find the filter option above your order list.<\/p>\n

    If you click on the All Dates<\/strong> you\u2019ll get a dropdown menu of orders according to month and year. After that, all you need to do is click on particular month order<\/strong>. Here we have selected November 2021 orders.<\/p>\n

    \"delete<\/p>\n

    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<\/strong>, and later delete them permanently.<\/p>\n

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

    \"\"<\/p>\n

    Once again, we\u2019ll repeat the process of deleting the orders<\/strong> and moving them to the trash. Then, we can finally delete them by emptying the trash.<\/p>\n

    That\u2019s it! You have successfully deleted WooCommerce orders<\/strong> from the WooCommerce dashboard.<\/p>\n

    By default, WooCommerce lists 25 orders<\/strong> 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.<\/p>\n

    Not only that, you\u2019ll have the same request over and over again which may result in a server error.<\/strong> But to avoid these limitations, you can just use a dedicated plugin to delete WooCommerce orders.<\/p>\n

    2. Remove WooCommerce Orders using a Plugin<\/h3>\n

    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<\/a> <\/strong>plugin.<\/p>\n

    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<\/strong>, 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.<\/p>\n

    \"delete-woocommerce-orders\"<\/p>\n

    2.1) Install and Activate the Plugin<\/h4>\n

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

    \"\"<\/p>\n

    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<\/a> for more information on it.<\/p>\n

    2.2) Remove orders from Plugin Interface<\/h4>\n

    The best part about this plugin is, you don\u2019t need additional configuration and setup for it. Once the plugin is activated, you can just go to Smart Manager <\/strong>from your WordPress dashboard which will redirect you to the plugin dashboard.<\/p>\n

    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 \u201cProducts<\/strong>\u201d or \u201cPosts<\/strong>\u201d. You need to set this option to Orders<\/strong>.<\/p>\n

    \"delete<\/p>\n

     <\/p>\n

    Upon clicking on Orders<\/strong>, 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 <\/strong>in the next option. Here, we have selected the Completed<\/strong> order status.<\/p>\n

    \"delete-woocommerce-orders\"<\/p>\n

    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<\/strong> from where you can Bulk Edit the data, print invoices for the orders, add records, and duplicate the delete and Export CSV.<\/p>\n

    While hovering on the Delete option, you\u2019ll get two options either to delete the orders permanently<\/strong> or move the orders to trash. Choose your preferred option and the plugin will remove the orders accordingly.<\/p>\n

    \"\"<\/p>\n

    2.3)\u00a0 Remove Orders with Advanced Search and Conditions<\/h4>\n

    Alternatively, you can delete an order with Advanced Search including conditions <\/strong>too. You can find the Advanced Search toggle on the Navigation Bar.<\/p>\n

    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.<\/p>\n

    \"\"<\/p>\n

    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<\/strong>.<\/p>\n

    \"\"<\/p>\n

    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.<\/p>\n

    \"\"<\/p>\n

    3. Delete WooCommerce Orders Programmatically – Using SQL query<\/h3>\n

    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.<\/p>\n

    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<\/strong>.\u00a0If you don\u2019t have the credentials for phpMyadmin, you can access it via cPanel or contact your hosting provider<\/a>.<\/p>\n

    Note<\/strong>: Make sure to always create a backup of your website<\/a> 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<\/a> first.<\/p>\n

    After you’ve logged in to phpMyAdmin, you need to find your website database.<\/p>\n

    Depending on your WordPress database, the table prefix can be different instead of \u201cwp_<\/em>\u201d. By default, it is \u201cwp_<\/em>\u201d which is also the same in our case. But if your table prefix is something else, replace \u201cwp_<\/em>\u201d with your custom WordPress database prefix.<\/p>\n

    \"delete<\/p>\n

     <\/p>\n

    Now go to the SQL tab and add the following snippet in the query section. and click on Go<\/strong>.<\/p>\n

    UPDATE wp_posts SET post_status = 'trash' WHERE post_type = 'shop_order';<\/pre>\n

    \"\"<\/p>\n

    You can execute this simple SQL command to move all orders to trash.<\/p>\n

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

    \"delete<\/p>\n

    But if you have large orders and want to skip the trash, just add \u00a0--force<\/code> to the end of the command.<\/p>\n

    wp post delete $(wp post list --post_type='shop-order' --format=ids) --force<\/pre>\n

    To delete selected order with order status, you can update the snippets like this too:<\/p>\n

    UPDATE wp_posts SET post_status = 'trash' WHERE post_type = 'shop_order'AND post_status = 'wc-completed'<\/pre>\n

    If you’d like to delete orders with a different status, here are the available options you can replace:<\/p>\n