首页 > 解决方案 > 通过 Woocommerce Rest API 创建订单时,订单备注显示两个订单状态备注,并且未发送正确的电子邮件

问题描述

通过 WooCommerce REST API 创建订单时遇到问题。有两个问题:

  1. 订单备注通过桌面创建订单时:-“银行转账”的新订单作为付款创建两个订单备注
  2. 订单状态从待付款更改为暂停
  3. 对于订单库存减少

通过手机创建订单时:- 使用“银行转账”作为付款方式的新订单创建三个订单备注:- 1. 订单状态从待付款更改为处理中 2. 订单库存减少 3. 订单状态从待付款更改为暂停

  1. 客户收到一封带有状态处理的电子邮件,而订单状态为搁置

在创建订单和更新订单付款详细信息时,我尝试从 API 传递订单状态=暂停。但问题仍然存在。

订单创建api

发布 wc-api/v3/orders/

身体
{ "order": { "customer_id": 6925, "billing_address": { "first_name": "Android", "last_name": "Testing", "address_1": "Address of Developer", "address_2": "Cengkareng", "city": "Jakarta Barat", "state": "6", "postcode": "12345", "country": "ID", "email": "ankurgecr@gmail.com", "phone": "1234567890" }, "shipping_address": { "first_name": "Android", "last_name": "Testing", "address_1": "Address of Developer", "address_2": "Cengkareng", "city": "Jakarta Barat", "state": "6", "postcode": "12345", "country": "ID" }, "line_items": [ { "product_id": 32776, "quantity": 1, "subtotal": 10000, "total": 10000, "variations": { "Color": "Blue" } } ], "fee_lines": [ { "title": "Rp", "total": 846 } ], "shipping_lines": [ { "method_id": "OKE", "method_title": "JNE OKE", "total": 29500 } ], "is_vat_exempt": false } }

订单更新 API

发布 wc-api/orders/[orderID]

身体 { "order": { "status": "on-hold", "payment_details": { "method_id": "bacs", "method_title": "Bank Transfer BCA / MANDIRI", "paid": true }, "set_paid": true } }

客户应收到一封订单状态 = 暂停的电子邮件。

我附上了实际结果的图像。

注意:如果我们从网站结帐中下订单,它工作正常,只有休息 API 有问题。

标签: wordpressapiwoocommercewoocommerce-rest-api

解决方案


推荐阅读