Command-line tools
List, test, explain, export, and import Free automation rules with WP-CLI.
Reviewed 2026-08-05
Available commands
wp osa list [--enabled] [--format=table|csv|json|yaml|ids]
wp osa preview [--rule=<id>] [--since=<date>] [--until=<date>] [--limit=<n>] [--format=table|csv|json|yaml]
wp osa explain <order_id> --rule=<rule_id>
wp osa export [--file=<path>]
wp osa import <file>
How to read the examples: angle brackets such as <order_id> mark a value you must replace. Items in square brackets such as [--enabled] are optional. An option without square brackets, such as --rule=<rule_id> in explain, is required. The | character separates the accepted values for an option.
List rules
wp osa list [--enabled] [--format=<format>]
| Option | Required? | Meaning |
|---|---|---|
--enabled | No | Show only enabled rules. Without it, enabled and disabled rules are listed. |
--format=<format> | No | Output as table, csv, json, yaml, or ids. Defaults to table. |
Use wp osa list to inspect rules without opening the admin. For example, wp osa list --enabled --format=ids prints the IDs of enabled rules for use in a script.
Preview matches
wp osa preview [--rule=<id>] [--since=<date>] [--until=<date>] [--limit=<n>] [--format=<format>]
All options are optional. With no options, the command previews every rule against up to 200 recent orders in each rule’s trigger status.
| Option | Required? | Meaning |
|---|---|---|
--rule=<id> | No | Preview only the rule with this numeric WordPress rule ID. |
--since=<date> | No | Include only orders created on or after this date, written as YYYY-MM-DD. |
--until=<date> | No | Include only orders created on or before this date, written as YYYY-MM-DD. |
--limit=<n> | No | Scan at most this many orders per rule. Defaults to 200; the minimum is 1. |
--format=<format> | No | Output as table, csv, json, or yaml. Defaults to table. |
preview is read-only. It checks trigger status and conditions, but it does not simulate settling delays, schedule windows, or time-in-status thresholds.
For example:
wp osa preview --rule=56 --since=2026-01-01 --limit=500
Explain one order
wp osa explain <order_id> --rule=<rule_id>
| Argument or option | Required? | Meaning |
|---|---|---|
<order_id> | Yes | The numeric WooCommerce order ID to inspect. This is the internal ID, not necessarily the displayed order number. |
--rule=<rule_id> | Yes | The numeric WordPress ID of the rule to evaluate. |
For example, wp osa explain 1234 --rule=56 explains whether rule 56 would fire for order 1234. The output shows the trigger status check, schedule check, and every condition with the order’s actual value.
Export rules
wp osa export [--file=<path>]
| Option | Required? | Meaning |
|---|---|---|
--file=<path> | No | Write JSON to this file. Without it, JSON is written to standard output. |
Both wp osa export --file=rules.json and wp osa export > rules.json create an export file.
Import rules
wp osa import <file>
| Argument | Required? | Meaning |
|---|---|---|
<file> | Yes | Path to a readable JSON file created by wp osa export. |
Import is additive: it validates and adds rules without overwriting existing ones. The result reports how many rules were imported or skipped. Review store-specific products, methods, coupons, and statuses after importing.