Some exemples of command lines to create, view, update and delete an order:
wp wc shop_order create --user=my-login --customer_id=2 --line_items='[{"product_id":1201}]'
Success: Created shop_order 6428.
wp wc shop_order get 6428 --user=my-login
[The table of the order…]
wp wc shop_order get 6428 --user=my-login --field=line_items | sed '{ s/{/{\n\t/g ; s/}/\n}/g ; s/\(,"\)/,\n\t"/g }'
[Only the "line_items" field, formated with sed. See the "id" field, not the "product_id" field. Suppose it is: 376.]
wp wc shop_order update 6428 --user=my-login --customer_id=2 --line_items='[{"id":376,"quantity":2},{"product_id":1202}]'
[update the quantity of the 376 item and add a new product 1202. You can see the result with:]
wp wc shop_order get 6428 --user=my-login --field=line_items | sed '{ s/{/{\n\t/g ; s/}/\n}/g ; s/\(,"\)/,\n\t"/g }'
wp wc shop_order delete 6428 --user=my-login
[move the order to trash]
wp help wc shop_order
[the help]
NOTA: these commands only manage the orders, but don’t send email. Probably I need a new command to send the purchase order to the customer. If you know the solution, please post it, if not, I will probably open a new topic on this.
In any case, the main subject of this thread is resolved, I mark it.
-
This reply was modified 3 years, 6 months ago by regivanx.