Manage WooCommerce Archived Orders via CLI
↑ Back to topArchiva supports WP-CLI, enabling store owners and developers to archive, unarchive, inspect, list, and delete WooCommerce orders directly from the command line. This is ideal for automating cleanup tasks, optimizing store performance, and managing large order volumes efficiently.
Archive orders
wp wc-order-archive archive --limit=50 --dry-run --before=365 --status=wc-failed
Moves eligible WooCommerce orders from WooCommerce > Orders to WooCommerce > Archived Orders. By default, up to 100 orders are processed per cycle.
Parameters
- limit – optional (integer)
- Number of orders to archive in one cycle. Default is 100. Max allowed: 500.
- dry-run – optional
- Simulates the process without actually archiving any orders. Useful for previewing which orders will be archived.
- before – optional (integer)
- Archive orders older than the specified number of days. If omitted, the plugin uses the setting from WooCommerce > Settings > Archiva > Automatically archive orders received earlier than X days.
- status – optional (string)
- Comma-separated list of order statuses to archive (e.g.,
wc-completed,wc-failed
). No spaces allowed. If not included, uses the value in WooCommerce > Settings > Archiva > Order statuses to be archived.
- Comma-separated list of order statuses to archive (e.g.,
Unarchive orders
wp wc-order-archive unarchive --order-id=1234
Moves orders from Archived Orders back to WooCommerce > Orders. Either the order-id OR the order-number should be provided. The plugin will display basic order information and ask for confirmation before proceeding.
Parameters
- order-id – optional (integer)
- Accepts one or more order IDs (comma-separated). Max: 100 IDs.
- order-number – optional (integer)
- Accepts one or more order numbers (comma-separated). Max: 100.
Delete archived orders
wp wc-order-archive delete --order-id=1234
Permanently deletes an archived order. Only one order can be deleted per command execution. Either the order-id OR the order-number should be provided. The plugin displays basic order information and asks for confirmation before proceeding.
- order-id – optional (integer)
- order-number – optional (integer)
Archiva stats
wp wc-order-archive stats
Displays basic stats like number of orders archived, the last time the archival cycle ran. It also displays archived order count by order status.
List archived orders
wp wc-order-archive list --limit=30 --page=4
Parameters
- limit – optional (integer)
- Number of orders to display. Default: 30. Max: 50.
- page – Optional (integer)
- Pagination index. Default: 1.
View archived order details
wp wc-order-archive inspect --order-id=1234
wp wc-order-archive inspect 1234
View order details for an archived order. Either the order-id OR the order-number should be provided. The order-id or order-number can be passed along with the parameter name or as the first argument.
Parameters
- order-id – optional (integer)
- order-number – optional (integer)
Please feel free to reach out to us for any further queries.