Archive Old Orders for WooCommerce

Summary

↑ Back to top

Archive Old Orders for WooCommerce helps store owners keep their WooCommerce admin fast and organized by automatically archiving old orders. Archived orders are moved out of the main order list, improving performance and decluttering your workflow, while still allowing you to access, export, or restore them at any time.

Installation

↑ Back to top

The simplest way to start using a product from WooCommerce.com is to use the “Add to store” functionality on the order confirmation page or the My subscriptions section in your account.

  1. Navigate to My subscriptions.
  2. Find the Add to store button next to the product you’re planning to install.
  3. Follow the instructions on the screen, and the product will be automatically added to your store.

Alternative options and more information at:
Managing WooCommerce.com subscriptions.

Adding a WooCommerce.com subscription to your store

Settings Overview & Description

↑ Back to top

Go to WooCommerce > Settings > Advanced > Order Archive to configure the plugin.

General Settings

↑ Back to top
  • Enable automatic order archiving: Toggle to turn the archiving feature on or off.
  • Show archived orders on My Account page: Display archived orders to customers in their account area.
  • Delete Archived Orders Older Than (Days): Set how long archived orders are kept before being deleted from the orders page (not permanently deleted).
  • Archive cycle (Hours): How often the plugin checks for and archives eligible orders.
  • Order Statuses to Archive: Select which WooCommerce order statuses (e.g., Completed, Processing) should be archived.
  • Archive Failed/Cancelled Orders Older Than (Days): Set a separate threshold for archiving failed or cancelled orders where customers never completed checkout.

Advanced Settings

↑ Back to top
  • Automatically Delete Archived Orders: Enable to permanently delete archived orders after a set period.
  • Permanently Delete Archived Orders Older Than (Days): Set the number of days after which archived orders are permanently deleted (minimum 90 days).
  • Remove All Plugin Data When Uninstalling: If enabled, all plugin data will be deleted when the plugin is uninstalled.

Export

↑ Back to top

Exports all archived orders in CSV, XML, or JSON format from the settings page.

Usage

↑ Back to top

Archiving Orders: Orders older than the configured number of days and with selected statuses are automatically archived in the background.

Accessing Archived Orders: Go to WooCommerce > Orders Archive in the admin to view, restore, or export archived orders.

Restoring Orders: Archived orders can be restored to the main order list from the Archived Orders page.

Exporting Orders: Use the Export section in the settings to download archived orders in CSV, XML, or JSON format.

Customer View: If enabled, customers can view their archived orders in their My Account area.

Use-case scenario

↑ Back to top

Peter has a store with 100 000 orders placed of the course of 6 years. This is causing the Orders page in the admin area to be incredibly slow and the bulk of those orders are no longer needed. In addition, Peter’s store is not HPOS compatible because of 3rd party plugins. Peter would like to bulk archive all orders older than a year immediately

This are some options available to Peter while using Archive Old Orders for WooCommerce:

Basic

In the plugin settings area under WooCommerce > Settings > Advanced > Order Archive, ensure that archiving is enable and set the Archive cycle to 0.5. This will run an automated archiving cycle every 30minutes and archive 50 orders at a time.

If store managers would like to manually run an archiving cycle outside of the timeframe specified above, please follow these steps:

  1. Navigate to WooCommerce > Status > Schedule Actions
  2. In the top right-hand corner, search for the aoo_archive_wc_orders schedule actions
  3. Click on Run below the schedule action.

Advanced

If waiting for the scheduled actions to trigger is still too slow, store managers can use the following:

  • Increase the batch size of orders to be archived using custom coding (default 50);
  • Archive orders using WP CLI

To increase the batch size of the scheduled order action, use the aoo_auto_archive_orders_per_cycle filter:

add_filter( 'aoo_auto_archive_orders_per_cycle', function( $batch_size ) {
    return 100; // Set to your desired batch size
} );

To increase the limit size of the WP CLI command (default 500), use the aoo_wp_cli_archive_max_limit filter:

add_filter( 'aoo_wp_cli_archive_max_limit', function( $max ) {
    return 2000 // Set to your desired CLI batch size
} );

This code snippet can be added to your website using a 3rd party plugin like Code Snippets

Please note: Increasing batch and limit sizes is very dependent on server specs. We recommend adjusting these cautiously in consultation with your web hosting provider.

FAQ

↑ Back to top

Q: Will archiving orders delete them from my store?

A: No. Archived orders are simply moved out of the main order list into a separate database table. They remain accessible and can be restored or exported at any time unless permanently deleted from the archived orders page as well.

Q: Can I choose which order statuses are archived?

A: Yes. You can select which WooCommerce order statuses (e.g., Completed, Processing) are eligible for archiving in the plugin settings.

Q: How do I permanently delete archived orders?

A: Enable “Automatically Delete Archived Orders” in the Advanced settings and set the desired retention period.

Q: Can customers see their archived orders?

A: Yes, if you enable the “Show archived orders on My Account page” option.

Q: Does uninstalling the plugin remove all data?

A: If you enable “Remove All Plugin Data When Uninstalling,” all plugin data will be deleted upon uninstall.

Q: Is there WP-CLI support?

A: Yes, the plugin provides WP-CLI commands for advanced users. See the WP-CLI Usage section below.

WP-CLI Usage

↑ Back to top

The plugin provides a set of WP-CLI commands for advanced management of archived orders. All commands are prefaced with wp wc-order-archive.

Archive Orders

↑ Back to top

Archive eligible orders based on plugin settings or override with options.

wp wc-order-archive archive --limit=50 --before=365 --status=wc-completed,wc-processing --dry-run
  • --limit: Number of orders to process in this run (max 500, default 50).
  • --before: Archive orders older than this number of days (default: plugin setting or 365).
  • --status: Comma-separated list of order statuses to archive (default: plugin setting).
  • --dry-run: Show which orders would be archived, but do not make changes.

Unarchive Orders

↑ Back to top

Restore archived orders to the main order list.

wp wc-order-archive unarchive --order-id=123

OR:

wp wc-order-archive unarchive --order-number=1001

You can provide a comma-separated list for multiple orders (max 50 at a time).

Delete Archived Orders

↑ Back to top

Permanently delete archived orders.

wp wc-order-archive delete --order-id=123

OR:

wp wc-order-archive delete --order-number=1001

List Archived Orders

↑ Back to top

Display a paginated list of archived orders.

wp wc-order-archive list --limit=30 --page=1

Inspect Archived Order

↑ Back to top

Show details for a specific archived order. 123 in the example below is based on the order ID.

wp wc-order-archive inspect 123

Archive Stats

↑ Back to top

Show statistics about archived orders.

wp wc-order-archive stats

Related Products

Offer add-ons like gift wrapping, special messages or other special options for your products.

Add shipment tracking information to your orders.