doucitao2944 2015-07-13 20:16
浏览 55

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!

  • 写回答

1条回答 默认 最新

  • dongwa3808 2015-07-16 12:57
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。