Would you like to automatically delete old WooCommerce orders? Old orders might be redundant and consume memory in your database. So, it’s a wise move to remove all redundant orders from the WordPress database. You can manually delete the old orders, but it takes time and is a hassle every day for you.

Let’s use the plugin for this. It’s a simple, set and forget WordPress plugin with no bloat whatsoever.

Get Started with WC Auto Delete Old Orders Plugin now. It automatically takes control of the old orders. You just install and the plugin takes your care.

Pricing

Life
$29
  • Lifetime Updates
  • 1 year of support
  • 1 Site
  • 7 days money-back guarantee *

* 100% refund when the product had a bug/problem I couldn’t resolve.

* Checkout and Payment are processed from Freemius – the reseller of the plugin.

Have pre-sale questions? Contact Me.

How does the plugin work?

The plugin automatically deletes old orders (orders older than 30 months by default, customizable in Settings). It uses the Action Scheduler to schedule the deletion. Every hour it checks if any order is older than 30 days (or specified in settings). Then it deletes 10 orders in an hour if there are so many old orders. So, you won’t be facing timeout in case of large number of orders.

You can see the tasks in Tools > Scheduled Actions, search for “wc_delete_old_orders_process”.

Settings

In the WooCommerce > Settings > General, you can set how many months old orders you want to get automatically deleted.

That’s all. If you like this plugin, checkout my other plugins.

WooCommerce Auto Delete Old Orders – A Set And Forget Plugin
Tagged on:     

Sanjeev Aryal

Don't bury your thoughts, put your vision into reality ~ Bob Marley.

4 thoughts on “WooCommerce Auto Delete Old Orders – A Set And Forget Plugin

  • April 9, 2023 at 11:49 am
    Permalink

    I’m using the plugin, but it only deletes 3 orders per action.
    How should I delete all orders for these 3 months?

    Reply
    • April 17, 2023 at 10:02 am
      Permalink

      Hi Carlos, if you have so many old orders, the PHP script will time out before it could delete all order at once. Maybe you can just run the process in a 5 minutes interval than in a day?

      Hope that will help!

      Reply
  • March 29, 2023 at 6:34 pm
    Permalink

    hi? how are you?

    i need help trying to implement this code to bookings of woocommerce


    heres is the code:

    public function process_delete() {
    if ( ! function_exists( ‘get_wc_booking’ ) ) {
    return;
    }
    $args = array(
    ‘date’ => ‘update_status(‘completed’);
    \wp_update_post( $booking ->get_id() );
    }
    }
    }
    “”
    and this is the order code thats work
    “”
    public function process_delete() {
    if ( ! function_exists( ‘wc_get_orders’ ) ) {
    return;
    }
    $args = array(
    ‘date_created’ => ‘update_status(‘completed’);
    \wp_delete_post( $order->get_id() );
    }
    }
    “”
    I don’t know what’s wrong, if it’s a misspelled function or what.

    Reply
    • April 17, 2023 at 10:00 am
      Permalink

      Hi Julian, thanks for reaching out. Unfortunately, it’s hard to debug without details on the booking plugin you’re using.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *