Archive old WooCommerce orders without a paid plugin
Published Updated 2 min read
A WooCommerce store a year or two old has thousands of orders. Most are completed and paid, some cancelled, and none need to sit in the main orders view beside today's work. The admin slows, filters get harder to use, and every report wades through old data before it shows what you want.
The usual advice is an archiving plugin, and the capable ones are paid. For a single store with a clear idea of what it needs, a plugin built to that spec does the job without a subscription.
Years of orders in today's list
WooCommerce stores every order in the database, and after a few years of trading that can be tens of thousands of rows. That is not a database problem in itself; it is an admin problem, because the orders list, every filter, every export and every report runs across the whole lot.
Day to day it is worse. A search for a current order by name or number returns matches from years back. Processing today's refunds or shipping updates means scrolling past orders completed three years ago. Archiving moves history somewhere you can still find it, out of the view you use every day.
Why not just delete them?
Deleting orders is usually a mistake. Most jurisdictions require order records to be kept for several years for tax. A refund dispute months later needs the original order. Deleting also removes purchase history, which matters for loyalty schemes and for GDPR requests, where you need to know what data you hold.
Archiving gives the orders a status of their own instead. They stay in the database with their line items, customer details and payment data intact, so tax records are untouched; they just drop out of the main view and your daily filters. For almost every store, that is the sensible middle ground.
A queue, a CSV and an Archived tab
Settings under WooCommerce > Archive Orders take an age threshold in days (365 by default) and the statuses to include (completed and cancelled ticked, processing not). Any matching order older than the threshold joins the queue.
The queue is a table of order number, date, status, customer name, billing email and total, with a checkbox per row and Select All. Export to CSV downloads the selected orders as a spreadsheet; Bulk Archive moves them to the archived status over AJAX and they leave the main orders list.
A second tab lists every archived order with an Unarchive button that restores the status it had before. Archived orders can also be found in WooCommerce > Orders by filtering on the Archived status, if you need to search by customer or order number.
Scheduled archiving and many stores
Archiving here is manual. Running it automatically on a schedule takes a WP-Cron hook, which is a separate build.
If you run several WooCommerce stores and want one set of archiving rules for all of them, a plugin per site is less convenient than a managed product. For one store with a backlog of old orders, this covers it.
What you get
Included
- Bulk-archiving WooCommerce orders older than a configurable number of days
- Exporting selected orders to CSV before archiving
- A separate archived orders view with individual unarchive controls per row
- Settings for the age threshold and which order statuses are included in the queue
Not included
- Permanently deleting orders from the database
- Automatically archiving orders on a schedule without manual action
- Hiding archived orders from WooCommerce Analytics reports
- GDPR erasure requests or anonymising customer data on archived orders
Export and Archive Old Orders for WooCommerce does the things on the right. This build covers the part most sites use.
Questions
Will archived orders still show in WooCommerce reports?
Archiving changes an order's status, and reports that filter on standard statuses will treat archived orders differently from completed ones. If you rely on historical revenue figures, export a CSV of the orders before archiving them.
Build it in Steem
The button opens the builder with this guide's prompt filled in, so you can change anything before it runs. Nothing is built, and nothing is charged, until you send it.
Read the prompt (203 words)
Build a WordPress plugin for WooCommerce that archives old orders. Add a settings page under WooCommerce > Archive Orders > Settings with two fields: a number input for the age threshold in days (default 365) and a checkbox list of WooCommerce order statuses to include in the archiving queue (completed and cancelled checked by default, processing unchecked). Register a custom WooCommerce order status called Archived (slug wc-archived) that is excluded from the main WooCommerce orders admin list. Add an admin page called Archive Orders under the WooCommerce menu with two tabs: Queue and Archived. The Queue tab shows a table of all orders older than the configured threshold that match the selected statuses, with columns for order number, date, status, customer name, billing email, and order total. Include checkboxes per row, a Select All control, a Bulk Archive button that changes the status of selected orders to wc-archived via AJAX, and an Export to CSV button that downloads selected orders as a CSV file with those same columns. The Archived tab shows all orders with wc-archived status using the same table columns, with a per-row Unarchive button that reverts each order to its previous status stored in order meta before the archive action.
Steem