user3923704
user3923704

Reputation: 31

WooCommerce API update order status

When trying to update the order with

$client->orders->update_status($order_id_to_update, $status);

it creates a new order with the exact same information and updates status for both the original and the newly created order. How can I stop this from happening and only have my submitted order_ID changing status?

Upvotes: 2

Views: 8287

Answers (3)

Giga Chad Coding
Giga Chad Coding

Reputation: 198

With Python it's as simple as print(wcapi.put("orders/727", data).json()), where data is a key-value pair object.

See: http://woocommerce.github.io/woocommerce-rest-api-docs/#orders

Upvotes: 1

Goms
Goms

Reputation: 2644

Verify that you have give a coherent order_id_to_update and well status ! If you put a int value on $status, you'll have a order who have a know status, so it will not visible in wordpress

Upvotes: 0

mujuonly
mujuonly

Reputation: 11861

$order = new WC_Order($order_id);
$order->update_status('pending');

Try this code snippet

Upvotes: 1

Related Questions