2.7: A new CLI for WooCommerce

WooCommerce brings many improvements to the WP-CLI powered command-line interface we introduced back in WooCommerce 2.5.

WP-CLI is a set of command-line tools for managing WordPress installations Our WC-CLI layer adds tools for managing products, coupons, payment gateways, shipping zones, and much more.

In WooCommerce 2.5 and 2.6, the CLI was powered by it’s own separate code. This code was separate from the REST API or WC core, meaning code could end being duplicated across the code base, or it meant that certain things possible in the REST API were not possible at all with the CLI.

2.7 introduces a new CLI powered by the REST API. We did this by forking Restful. This reduced the amount of code be need to maintain, provides a lot more power and commands, and means that the commands will always be current as we improve our REST API in the future.

Currently, following commands are available with list, get, update, and create operations:

wp wc customer 
wp wc customer_download 
wp wc order_note 
wp wc payment_gateway 
wp wc product 
wp wc product_attribute 
wp wc product_attribute_term 
wp wc product_cat 
wp wc product_review 
wp wc product_shipping_class 
wp wc product_tag 
wp wc product_variation 
wp wc shipping_method 
wp wc shipping_zone 
wp wc shipping_zone_location 
wp wc shipping_zone_method 
wp wc shop_coupon 
wp wc shop_order 
wp wc shop_order_refund 
wp wc tax 
wp wc tax_class 
wp wc tool 
wp wc webhook 
wp wc webhook_delivery 

There is a wiki page containing more information and examples. We’ll also work on generating documentation similar to our REST API documentation for each command. You can also use the —help flag to find out each commands parameters.

Please test out the new CLI commands and provide feedback or bug reports on GitHub!


7 responses to “2.7: A new CLI for WooCommerce”

  1. Antonio de Carvalho Avatar
    Antonio de Carvalho

    Hi there,

    is there a beta release we can test with or shall we use the master branch in github?

    Cheers
    A

    1. Hi, A beta will be out very very soon (and posted on this blog). If you want to test in the meantime though, the CLI is in master.

      1. Great! Thanks. Will download and start testing it.

  2. […] You can read more about the new CLI here. […]

  3. Will you be making any videos on examples with how one can utilize this interface?

Leave a Reply

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