Start a free 14-day trial by December 1 on a wide range of WooCommerce Marketplace extensions and themes. Explore products

Ultimate Draft Order Cleanup Manager

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 top

To 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.

  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.

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 top

The extension has two screens:

  • WooCommerce > Settings > Order Cleanup holds the rules. Its sections are Initial Setup, Eligible Orders, Protection Rules, Privacy Action, Notifications, and Advanced.
  • WooCommerce > Status > Order Cleanup holds the tools. Its sections are Preview & Cleanup, Reports, Activity, and Test 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
  1. In the WordPress Admin dashboard, go to WooCommerce > Settings > Order Cleanup.
  2. In Initial Setup, confirm that Run automatically is off. Check Move to trash first and Keep trash for (days).
  3. In Eligible Orders, review each enabled status and retention period.
  4. In Protection Rules, add any orders, customers, products, payment methods, notes, or order totals that must be kept.
  5. Save changes in each section you edit.
  6. Go to WooCommerce > Status > Order Cleanup > Preview & Cleanup and select Preview Cleanup.
  7. Check the status counts, the oldest eligible orders, and the What happens line.
  8. Select Download CSV if you want a copy of the preview for your records.
  9. Select Execute Cleanup only after the preview matches your policy.
  10. Return to WooCommerce > Settings > Order Cleanup > Initial Setup and turn on Run automatically only when you are ready for scheduled runs.
Test the complete workflow on staging before enabling scheduled cleanup on a live store.

How eligibility works

↑ Back to top

An 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 top

These 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 top

Go to WooCommerce > Settings > Order Cleanup > Initial Setup.

Run automatically

↑ Back to top

Leave 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 top

Choose 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 top

Move 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 top

Choose 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 top

This 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_DIR constant in wp-config.php to use another directory, for example one outside the web root.
  • Use the docm_export_directory filter to change the directory.
  • Use the docm_export_retention_days filter to change the 30-day retention. Return 0 to keep files forever.
Treat exported CSV files as personal data. Restrict access, follow the store’s retention policy, and remove exports when they are no longer needed.

Configure eligible orders

↑ Back to top

Go to WooCommerce > Settings > Order Cleanup > Eligible Orders.

Order statusEnabled by defaultDefault retention
Checkout draftYes24 hours
Pending paymentNo7 days
FailedYes7 days
CancelledNo30 days
On holdNo7 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 top

Go 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 0 to disable.
  • Payment methods: skip orders that use selected payment methods.

Choose deletion or anonymization

↑ Back to top

Go to WooCommerce > Settings > Order Cleanup > Privacy Action.

Delete eligible orders

↑ Back to top

With 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 top

Turn 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.

Deletion and anonymization can affect support, refunds, reporting, tax records, and legal retention duties. Confirm the store’s policy before running cleanup.

Configure notifications

↑ Back to top

Go 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 top

Go to WooCommerce > Settings > Order Cleanup > Advanced. The defaults suit most stores.

Batch size

↑ Back to top

The 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 top

Orders 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 top

Writes extra diagnostics to WooCommerce > Status > Logs. Turn it on only while troubleshooting.

Preview and run cleanup

↑ Back to top

Go to WooCommerce > Status > Order Cleanup > Preview & Cleanup.

Preview cleanup

↑ Back to top

Select 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 happens line 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 top

In 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 top

Select 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 top

Every 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 top

Go 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 top

Go 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 top

Go to WooCommerce > Status > Order Cleanup > Test Orders.

Use test-order tools on staging or development sites. Do not generate disposable test orders on a live store.

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 top

WP-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 top

The 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_version and docm_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-cleanup group for automatic cleanup, background continuations, and the trash sweep
  • CSV audit files in the private export folder when Export before deleting is 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 top

Deactivating 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 top

Preview shows no eligible orders

↑ Back to top

Check 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 top

That 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 top

Confirm 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 top

Large 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 top

Check 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 top

Do 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 top

Summary 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 top

Find 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_DIR is 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 top

Check 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 top

Does the extension start deleting orders when it is activated?

↑ Back to top

No. 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 top

Rules 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 top

It 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 top

No. 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 top

Yes, 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 top

WooCommerce 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 top

No. 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 top

No. 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 top

Yes. 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 top

No. 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 first and Export before deleting are on
  • Relevant error text and the time of the Activity or WooCommerce > Status > Logs entry
  • 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.

Related Products

WooCommerce Subscriptions is a WooCommerce extension that lets customers subscribe to your products or...

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

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.