Ultimate Draft Order Cleanup Manager for WooCommerce clears out old failed, pending payment, canceled, on-hold, and checkout-draft orders with per-status retention rules, a preview before every cleanup, built-in protection for paid orders, a trash restore window, and optional scheduled cleanup.
Installation
↑ Back to topTo start using a product from WooCommerce.com, you can use the โAdd to storeโ functionality on the order confirmation page or the My subscriptions section in your account.
- Navigate to My subscriptions.
- Find the Add to store button next to the product youโre planning to install.
- 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.
Requirements
↑ Back to top- WordPress 6.7 or newer
- WooCommerce 9.9 or newer
- PHP 8.1 or newer
- An administrator or shop manager account with permission to manage WooCommerce
Tested with WordPress 7.1 and WooCommerce 11.3.
The extension supports High-Performance Order Storage (HPOS) and legacy WooCommerce order storage.
Where to find the extension
↑ Back to topThe extension has two screens:
WooCommerce > Settings > Order Cleanupholds the rules. Its sections areInitial Setup,Eligible Orders,Protection Rules,Privacy Action,Notifications, andAdvanced.WooCommerce > Status > Order Cleanupholds the tools. Its sections arePreview & Cleanup,Reports,Activity, andTest Orders.
In version 1.0.0 the tools were part of the Settings screen. Old bookmarks to those sections redirect to the new location.
Quick start
↑ Back to top- In the WordPress Admin dashboard, go to
WooCommerce > Settings > Order Cleanup. - In
Initial Setup, confirm thatRun automaticallyis off. CheckMove to trash firstandKeep trash for (days). - In
Eligible Orders, review each enabled status and retention period. - In
Protection Rules, add any orders, customers, products, payment methods, notes, or order totals that must be kept. - Save changes in each section you edit.
- Go to
WooCommerce > Status > Order Cleanup > Preview & Cleanupand selectPreview Cleanup. - Check the status counts, the oldest eligible orders, and the
What happensline. - Select
Download CSVif you want a copy of the preview for your records. - Select
Execute Cleanuponly after the preview matches your policy. - Return to
WooCommerce > Settings > Order Cleanup > Initial Setupand turn onRun automaticallyonly when you are ready for scheduled runs.
How eligibility works
↑ Back to topAn order becomes eligible only when all these conditions are true:
- Its status is enabled for cleanup.
- It was created longer ago than the retention period for that status.
- It is older than the
Minimum Order Age (minutes)setting. - No built-in protection applies to it.
- It does not match a protection rule.
Checkout drafts and failed orders are enabled by default. Pending-payment, canceled, and on-hold orders require explicit opt-in.
Built-in protections
↑ Back to topThese protections always apply. They cannot be turned off in settings. The extension never cleans:
- Processing, completed, or refunded orders
- Any order with a paid date
- Pending or on-hold orders with a payment transaction ID, such as authorized payments waiting for capture
- Orders with any refund, full or partial
- WooCommerce Subscriptions parent, renewal, resubscribe, and switch orders
- Orders that were restored from trash after the extension trashed them
- In anonymize mode, orders the extension already anonymized
When the extension removes an unpaid order, it returns any stock the order had reserved and releases the order’s coupon usage.
Configure initial setup
↑ Back to topGo to WooCommerce > Settings > Order Cleanup > Initial Setup.
Run automatically
↑ Back to topLeave this setting off while configuring and testing. It is off by default. When you turn it on, the extension creates a recurring WooCommerce Action Scheduler action. The first automatic run happens one interval after you turn it on.
Run every and time unit
↑ Back to topChoose a number and a unit: minutes, hours, or days. The default is 1 day. The shortest interval is 5 minutes.
Move to trash first
↑ Back to topMove to trash first is on by default. Eligible orders move to WooCommerce trash instead of being permanently deleted.
When this setting is off, eligible orders are permanently deleted in the same run. They cannot be restored.
Keep trash for (days)
↑ Back to topChoose how long orders trashed by the extension stay restorable. The default is 7 days. The range is 1 to 365 days.
During this window, restore an order from WooCommerce > Orders > Trash. A restored order gets its original status back. The extension never cleans it again.
After the window ends, a background sweep permanently deletes the orders this extension trashed. The sweep runs even when Run automatically is off. Execute Cleanup in delete mode also deletes trashed orders whose window has ended.
Orders trashed by people or by other plugins are never permanently deleted by this extension.
Export before deleting
↑ Back to topThis setting is off by default. It applies only in delete mode.
When it is on, the extension saves a CSV audit record before each batch of orders is moved to trash or deleted. The file lists order ID, status, date created, total, customer email (or Guest), item count, and whether the order has a customer note.
Files are saved in a private folder inside the WordPress uploads directory. The folder name is docm-exports- followed by a random string. The extension adds an .htaccess file that denies web access, plus blank index files. Files older than 30 days are removed automatically.
If the audit file cannot be saved, the run stops and no orders are removed. The failure is recorded in Activity. If this happens during a background run, a failure email is sent when notifications are on.
The CSV file is an audit record. It cannot be used to restore orders.
Developers can change the location and retention:
- Define the
DOCM_PRIVATE_EXPORT_DIRconstant inwp-config.phpto use another directory, for example one outside the web root. - Use the
docm_export_directoryfilter to change the directory. - Use the
docm_export_retention_daysfilter to change the 30-day retention. Return0to keep files forever.
Configure eligible orders
↑ Back to topGo to WooCommerce > Settings > Order Cleanup > Eligible Orders.
| Order status | Enabled by default | Default retention |
|---|---|---|
| Checkout draft | Yes | 24 hours |
| Pending payment | No | 7 days |
| Failed | Yes | 7 days |
| Cancelled | No | 30 days |
| On hold | No | 7 days |
For each status, set Enable cleanup, Retention period, and Retention unit. The unit can be minutes, hours, or days. Age is measured from the order creation date. Use values that match payment reconciliation, customer support, legal, tax, and accounting requirements for the store.
Configure protection rules
↑ Back to topGo to WooCommerce > Settings > Order Cleanup > Protection Rules. Protection rules take precedence over status and age rules. They add to the built-in protections.
- Orders: search for and select orders that must never be cleaned.
- Customers: select registered customer accounts whose orders must remain untouched.
- Products in order: skip orders containing any selected product or variation.
- Orders with notes: keep orders with a note the customer left at checkout or any order note added by a person. Notes that WooCommerce adds automatically do not count.
- Orders above total: skip orders at or above a monetary threshold. Use
0to disable. - Payment methods: skip orders that use selected payment methods.
Choose deletion or anonymization
↑ Back to topGo to WooCommerce > Settings > Order Cleanup > Privacy Action.
Delete eligible orders
↑ Back to topWith Anonymize Instead of Deleting off, the extension deletes eligible orders. It follows the Move to trash first, Keep trash for (days), and Export before deleting settings.
Anonymize eligible orders
↑ Back to topTurn on Anonymize Instead of Deleting to keep the order record and replace customer data with anonymized values.
In Customer Data to Anonymize, select the billing and shipping fields to clear. When the billing email is anonymized, the customer note is also cleared. Anonymized orders are marked and are not processed again. Anonymization cannot be undone.
Review the result on staging before using this mode on production data.
Configure notifications
↑ Back to topGo to WooCommerce > Settings > Order Cleanup > Notifications.
Send Cleanup Summary Emails is on by default. Leave Send Summaries To blank to use the WordPress site administrator email address, or enter another recipient.
The extension sends two kinds of email:
- A summary after each background run that processed orders. This covers every automatic run and the background part of a manual run. The summary includes total processed, successful, and failed counts, duration, a breakdown by action, and a link to
Activity. - A failure email when a background run stops with an error, for example when the audit export cannot be saved. Its subject ends with
Order cleanup stopped.
Configure advanced settings
↑ Back to topGo to WooCommerce > Settings > Order Cleanup > Advanced. The defaults suit most stores.
Batch size
↑ Back to topThe maximum number of orders processed in one batch. The range is 10 to 500, in steps of 10. The default is 100.
Minimum order age (minutes)
↑ Back to topOrders younger than this are never touched, whatever the retention rules say. The range is 5 to 1440 minutes, in steps of 5. The default is 30 minutes.
Debug mode
↑ Back to topWrites extra diagnostics to WooCommerce > Status > Logs. Turn it on only while troubleshooting.
Preview and run cleanup
↑ Back to topGo to WooCommerce > Status > Order Cleanup > Preview & Cleanup.
Preview cleanup
↑ Back to topSelect Preview Cleanup to find eligible orders without changing them. The preview shows:
- A table of eligible orders per status, with a total. When a status has more than 2,000 orders that match its status and age rules, the count is shown as approximate, for example
about 15,000. An approximate count can include orders that protections will skip. - In delete mode, a row for orders in trash whose restore window has ended. These are permanently deleted when you run cleanup.
- A
What happensline that states the action and, when trash is used, how many days trashed orders can be restored. - The oldest eligible orders, up to 100, with a link to each order, status, date, total, customer email, item count, and whether the order has a customer note.
If the result is unexpected, return to the settings, update them, save, and preview again.
Download CSV
↑ Back to topIn delete mode, when eligible orders exist, select Download CSV. The file lists up to 1,000 eligible orders with the same columns as the audit export. It downloads to your browser. Nothing is stored on the server.
Execute cleanup
↑ Back to topSelect Execute Cleanup. The confirmation shows how many orders will be cleaned, including trashed orders that will be permanently deleted. Confirm only when the displayed action is correct.
Manual cleanup processes orders in batches for about 20 seconds. If eligible orders remain, the result message says so, and cleanup continues in the background through Action Scheduler. Select Preview Cleanup again later to see what is left.
The result shows total processed, successful, and failed counts, and duration.
How large backlogs are processed
↑ Back to topEvery cleanup run works in batches, using the Batch size setting. Each run works for about 20 seconds. If eligible orders remain, it queues a background continuation in Action Scheduler. This repeats until no eligible orders are left. Manual and automatic runs work the same way.
Each order is attempted at most once per run. Skipped or failed orders cannot keep a run going.
Read reports
↑ Back to topGo to WooCommerce > Status > Order Cleanup > Reports. Reports show orders by status, eligible orders by status, total orders cleaned, cleanup runs this week and this month, the last cleanup, order-related database table sizes and row counts, and HPOS status. They do not guarantee a specific database-size or storefront-performance improvement.
Review activity
↑ Back to topGo to WooCommerce > Status > Order Cleanup > Activity.
Each cleanup run creates one entry, not one per batch. A background continuation of a large run records its own entry. Each entry shows the date, action, number of orders, successful and failed counts, duration, and a breakdown by action. The background trash sweep records its own entry. A run stopped by a failed audit export is also recorded.
Every run is also written to WooCommerce > Status > Logs with the source ultimate-draft-order-cleanup. The log entry shows how the run started (manual, scheduled, or WP-CLI) and the error text, if any. No customer data is written to these logs.
Each automatic cleanup run removes activity entries older than 180 days.
Clear All Logs permanently removes every activity entry and cannot be undone.
Use test orders
↑ Back to topGo to WooCommerce > Status > Order Cleanup > Test Orders.
Available scenarios cover empty drafts, partial customer data, zero totals, abandoned checkouts, failed payments, guest and registered customers, notes, aged orders, bot-like bursts, high-value orders, and mixed statuses.
Choose a scenario, the number of orders, and a creation date: the current date, a specific date, or a date range. Generate All Scenarios creates 5 orders for each scenario.
Generated orders are marked as test orders. Select Delete All Test Orders when testing is complete.
Use WP-CLI
↑ Back to topWP-CLI commands are intended for administrators, developers, and agencies with shell access.
wp docm cleanup preview
wp docm cleanup preview --limit=50 --format=json
wp docm cleanup run --dry-run
wp docm cleanup run --batch-size=100 --yes
wp docm cleanup run --mode=anonymize
wp docm cleanup stats
wp docm test-orders scenarios
wp docm test-orders generate --scenario=mixed_statuses --count=10
wp docm test-orders count
wp docm test-orders delete
wp docm cleanup run processes one batch. Without --batch-size, it uses the Batch size setting. Without --mode, it uses the mode from Privacy Action. --mode accepts only delete or anonymize. In delete mode, the batch also permanently deletes trashed orders whose restore window has ended. The command asks for confirmation unless you add --yes.
Data handling
↑ Back to topThe extension works with WooCommerce order data inside the WordPress site. It does not require an external service or API key.
- Cleanup settings and plugin version data in WordPress options, including
docm_db_versionanddocm_export_dir_suffix(the random part of the export folder name) - Cleanup activity in a plugin-owned database table
- Run summaries in WooCommerce logs under the source
ultimate-draft-order-cleanup - Action Scheduler actions in the
docm-cleanupgroup for automatic cleanup, background continuations, and the trash sweep - CSV audit files in the private export folder when
Export before deletingis on - Plugin metadata on orders it trashed, restored, or anonymized, and on generated test orders
Download CSV files are sent to your browser and are not stored on the server.
Deactivation and uninstall
↑ Back to topDeactivating the extension removes all its scheduled actions. While it is inactive, nothing runs, including the trash sweep. When you activate it again, it schedules automatic cleanup from the saved settings, and the trash sweep if trashed orders are waiting.
When deactivating from Plugins, choose Deactivate only to keep settings and activity data, or Remove data and deactivate to remove plugin-owned settings, activity data, and product settings metadata first.
Uninstalling removes plugin-owned settings, activity-log data, product settings metadata, and scheduled actions.
Neither option removes the docm_db_version and docm_export_dir_suffix options, CSV audit files, WooCommerce log entries, or plugin metadata on orders. Neither option restores deleted orders or reverses anonymization.
Troubleshooting
↑ Back to topPreview shows no eligible orders
↑ Back to topCheck that at least one status is enabled. Check that orders are older than the retention period for their status and older than Minimum Order Age (minutes). Check the built-in protections and your protection rules.
A count says “about”
↑ Back to topThat status has more than 2,000 matching orders, so the count is approximate. It can include orders that protections will skip. Run cleanup and check Activity for the actual numbers.
Automatic cleanup is not running
↑ Back to topConfirm Run automatically is on and settings are saved. The first run happens one interval after you turn it on. In WooCommerce > Status > Scheduled Actions, search for docm_scheduled_cleanup and check for a pending action in the docm-cleanup group. Confirm WP-Cron or the site’s server-side cron runner works.
Orders remain after manual cleanup
↑ Back to topLarge backlogs continue in the background. In WooCommerce > Status > Scheduled Actions, look for docm_execute_cleanup. Select Preview Cleanup again later to see what is left.
An expected order is missing from preview
↑ Back to topCheck whether a built-in protection applies: a paid date, a payment transaction ID on a pending or on-hold order, a refund, a subscription link, or an earlier restore from trash. Then compare its status, creation date, customer, products, payment method, total, and notes with every protection rule.
An order moved to trash unexpectedly
↑ Back to topDo not empty trash. Restore the order from WooCommerce > Orders > Trash before the Keep trash for (days) window ends. It gets its original status back, and the extension never cleans it again. Then update settings and preview again.
If Move to trash first was off, the order was permanently deleted. Restore it from a backup.
Summary email did not arrive
↑ Back to topSummary emails are sent only after background runs that processed orders. Confirm Send Cleanup Summary Emails is on, verify the recipient, and test the site’s general WordPress email delivery.
Cleanup stops because the audit export failed
↑ Back to topFind the error text in Activity or in WooCommerce > Status > Logs under the source ultimate-draft-order-cleanup. Then check:
- The WordPress uploads directory is writable by PHP and the server has free disk space.
- WordPress can write files directly without asking for FTP credentials.
- If
DOCM_PRIVATE_EXPORT_DIRis defined, that directory exists or can be created, and PHP can write to it.
On servers that ignore .htaccess files, such as Nginx, the random folder name is the main protection. To keep audit files outside the web root, define DOCM_PRIVATE_EXPORT_DIR. If you do not need audit files, turn off Export before deleting.
Cleanup reports failures
↑ Back to topCheck WooCommerce > Status > Logs for the source ultimate-draft-order-cleanup. Turn on debug mode in Advanced temporarily. Record the extension, WooCommerce, WordPress, and PHP versions; HPOS status; action mode; and error text. Do not include customer personal data.
Frequently asked questions
↑ Back to topDoes the extension start deleting orders when it is activated?
↑ Back to topNo. Automatic cleanup is off by default. Nothing changes until you run cleanup yourself or turn on automatic cleanup. Review the settings, run a preview, and turn on automatic cleanup only when the result matches the store’s retention policy.
Where are the settings and the tools?
↑ Back to topRules are in WooCommerce > Settings > Order Cleanup. Preview, manual cleanup, reports, activity, and test orders are in WooCommerce > Status > Order Cleanup.
Which order statuses can it clean?
↑ Back to topIt can target checkout drafts, pending-payment orders, failed orders, canceled orders, and on-hold orders. Checkout drafts and failed orders are enabled by default. The other statuses require explicit opt-in.
Will it delete paid or completed orders?
↑ Back to topNo. Processing, completed, and refunded orders are always protected. So are orders with a paid date, authorized payments, orders with any refund, and subscription orders. You can add your own protection rules for individual orders, customers, products, notes, totals, and payment methods.
Can I get back an order that was cleaned?
↑ Back to topYes, while it is in trash. Restore it from WooCommerce > Orders > Trash within the Keep trash for (days) window. After the window, or when Move to trash first is off, the order is permanently deleted. The CSV audit file is a record, not a restore file.
How is this different from WooCommerce’s personal data retention settings?
↑ Back to topWooCommerce core can move pending, failed, and canceled orders to trash after a fixed period. You set this in WooCommerce > Settings > Accounts & Privacy. WooCommerce core also deletes checkout drafts older than one day.
This extension adds a preview before anything changes, built-in payment protections, your own exclusions, on-hold orders, retention in minutes, hours, or days per status, a restore window, CSV export, batch processing for large backlogs, and a record of each run.
Does it stop card-testing attacks?
↑ Back to topNo. Use your payment gateway’s fraud tools, a CAPTCHA, or rate limiting to stop attacks. This extension cleans up the failed orders they leave behind.
Is this an abandoned-cart recovery extension?
↑ Back to topNo. It cleans eligible WooCommerce order records, including checkout drafts left by incomplete checkout sessions. It does not send abandoned-cart campaigns or replace a cart-recovery service.
Can I remove personal data without deleting the order record?
↑ Back to topYes. Anonymization mode keeps the order and replaces the selected billing and shipping fields with anonymized values.
Does it connect to an external service?
↑ Back to topNo. Cleanup runs inside WordPress and WooCommerce. The extension does not require an external account or API key.
Support request checklist
↑ Back to top- Extension version
- WooCommerce version
- WordPress version
- PHP version
- HPOS enabled or disabled
- Manual, scheduled, or WP-CLI trigger
- Delete or anonymize mode
- Whether
Move to trash firstandExport before deletingare on - Relevant error text and the time of the
ActivityorWooCommerce > Status > Logsentry - Steps to reproduce on staging, when possible
Never send order exports, customer email addresses, billing details, or other personal data unless support explicitly requests a secure transfer method.
