Woocommerce订单更新“woocommerce_api_invalid_customer_id”但我不是要更新客户

Seems Simple. I am trying to update an order via the V2 API in WooCommerce.

Here is the request which is being issued :

PUT /wc-api/v2/orders/8054?oauth_consumer_key=ck_notgoingtogiveittoyouinexample&oauth_nonce=same&oauth_signature_method=HMAC-SHA256&oauth_timestamp=1436817942&oauth_signature=same HTTP/1.1

Here is the json in the request body :

{"order": {"status": "completed"}}

Here is the result I am getting :

{"errors":[{"code":"woocommerce_api_invalid_customer_id","message":"Customer ID is invalid"}]}

The weird thing is, I am not asking to update the customer id, or anything besides the status.

Also, when this happens, WooCommerce does update the status, but it doesn't set it correctly.

I am getting a status note on the order of :

{ Order status changed from to {.

Do I have to serialize the entire order object back to the server? If not, any ideas what I am doing wrong?

Thanks!

[UPDATE #1]

So, after tracing through the API code, and adding some debug logging, I noticed the $data is not being set at all coming into the update function from the route. Since I am following all of the appropriate requirements "json in the request body, with json content type in the header", I am not sure what is going on. I was able to resolve this by using the API code as a template to create my own order update function. Now I am simply calling my own FlagOrderCompleted and it's working fine because I am not having to pass parameters. It's hacky and it isn't a catch all solution but at least it's working!

Customer id is required in the json body in order to successfully update the order. Please refer to this Resolved issue. And also this link for referring to the syntax of body with customer id.

Hope this solves your issue.