Sneak Peek: WP CLI Support in WooCommerce 2.5

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.

7 responses to “Sneak Peek: WP CLI Support in WooCommerce 2.5”

  1. gtyler2015 Avatar

    This might not be the place for this question…if so I apologize.
    I can’t seem to locate anywhere a rough calendar for WC releases? Is 2.5 targeted before year end? Q1 of next year?

    1. Just stay tuned for updates on this blog – there will be an announcement.

      1. gtyler2015 Avatar

        Thanks! So it’s looking like RC1 early January with full release mid-January.
        WP CLI has become such an amazing tool…so to have WC in the fold makes me a happy dude!

        In case someone is looking for the link:

  2. […] 2.5 mostly contains enhancements to existing functionality, but we have added some new features which developers will appreciate such as WP CLI support! […]

  3. […] other day was rainy and I was bored, so I decided to play a bit with the WooCommerce WP-CLI integration. And as I am a huge fan of WP-CLI, I wanted to create a products import system linked to an Alfred […]

  4. kj6jwg Avatar

    I’m trying to use this with WordPress 4.4.2 and WooCommerce 2.5.2.

    All I can get is: Error: ‘wc’ is not a registered wp command.

    Has it been added yet, or has it been delayed?

  5. kj6jwg Avatar

    Nevermind. I discovered the problem. WP Fastest Cache is not compatible with wp-cli. Once I disabled that, all my woes went away. I’ve posted to their support forum asking if they plan to fix it.

Leave a Reply

Your email address will not be published. Required fields are marked *