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!
Leave a Reply