WP CLI support is one of the features that’s included in WooCommerce 2.5 milestone. In case you haven’t heard WP-CLI:
WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser.
All WooCommerce related commands are grouped into wp wc
command:
$ wp wc
usage: wp wc coupon
or: wp wc customer
or: wp wc order
or: wp wc product
or: wp wc report
or: wp wc tool
See 'wp help wc <command>' for more information on a specific command.
Currently, following commands are available:
- Coupon
$ wp wc coupon usage: wp wc coupon create [--<field>=<value>] [--porcelain] or: wp wc coupon delete <id>... or: wp wc coupon get [--field=<field>] [--fields=<fields>] [--format=<format>] or: wp wc coupon list [--<field>=<value>] [--field=<field>] [--fields=<fields>] [--format=<format>] or: wp wc coupon types or: wp wc coupon update <coupon> --<field>=<value> See 'wp help wc coupon <command>' for more information on a specific command.
- Customer
$ wp wc customer usage: wp wc customer create [--<field>=<value>] [--porcelain] or: wp wc customer delete <customer>... or: wp wc customer downloads [--field=<field>] [--fields=<fields>] [--format=<format>] or: wp wc customer get [--field=<field>] [--fields=<fields>] [--format=<format>] or: wp wc customer list [--<field>=<value>] [--field=<field>] [--fields=<fields>] [--format=<format>] or: wp wc customer orders [--field=<field>] [--fields=<fields>] [--format=<format>] or: wp wc customer update <customer> --<field>=<value> See 'wp help wc customer <command>' for more information on a specific command.
- Order
$ wp wc order usage: wp wc order create [--<field>=<value>] [--porcelain] or: wp wc order delete or: wp wc order get [--field=<field>] [--fields=<fields>] [--format=<format>] or: wp wc order list [--<field>=<value>] [--field=<field>] [--fields=<fields>] [--format=<format>] or: wp wc order update <id> --<field>=<value> See 'wp help wc order <command>' for more information on a specific command.
- Product
$ wp wc product usage: wp wc product category or: wp wc product create [--<field>=<value>] [--porcelain] or: wp wc product delete <id>... or: wp wc product get [--field=<field>] [--fields=<fields>] [--format=<format>] or: wp wc product list [--<field>=<value>] [--field=<field>] [--fields=<fields>] [--format=<format>] or: wp wc product reviews [--field=<field>] [--fields=<fields>] [--format=<format>] or: wp wc product types or: wp wc product update <id> --<field>=<value> See 'wp help wc product <command>' for more information on a specific command.
- Report
$ wp wc report usage: wp wc report list [--format=<format>] or: wp wc report sales [--field=<field>] [--fields=<fields>] [--format=<format>] [--period=<period>] [--date_min] [--date_max] [--limit] or: wp wc report top_sellers [--<field>=<value>] [--field=<field>] [--fields=<fields>] [--format=<format>] [--period=<period>] [--date_min] [--date_max] [--limit] See 'wp help wc report <command>' for more information on a specific command.
- Tool
$ wp wc tool usage: wp wc tool clear_transients See 'wp help wc tool <command>' for more information on a specific command.
Here’s the demo of WooCommerce CLI in action:
In case a command is not obvious to you, appending --help
should give you more information about the command.
This feature is available in master branch. If you find the feature is useful in the next release, we encourage you to checkout the branch, test it, and report any issues to our GitHub’s issues tracker.
Leave a Reply