After the following script is run

wp wc product create --name='b' --categories=32 --user=user

Output is printed:

Success: Created product 1370.

But no categories are shown in wp-admin/WooCommerce->Products page for the newly added product.

I have followed Find Product Category IDs to get category id. Tried to use [32], ['32'] instead of 32. The result is the same. Category is not shown in wordpress admin. How to fix it?

1 Answer 1


After opening issue on woocommerce github page and authors reaction.

The solution is

wp wc product create --name='Product Name' --categories='[ { "id" : 21 } ]' --user=admin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.