【发布时间】:2015-09-16 18:56:33
【问题描述】:
我发现,当我使用 BigCommerce API 更新订单时,订单的产品行项目出现重复。似乎即使我在我的订单更新 JSON 对象中传递了一个单行项目,我也会得到两行返回(订单产品)。
我正在按照此处记录的方式进行更新调用:https://developer.bigcommerce.com/api/stores/v2/orders#update-an-order
更新成功但是我原来的产品现在是两条产品线。 似乎 BC 将我发送的内容解释为新产品线,而不是替换/更新现有产品线。
我正在传递 orderProducts 的“id”。
我需要传递一些东西来表明订单项要更新而不是新建吗?enter code here
这是我发送的 JSON:
{
"customer_id": 1,
"date_created": "Mon, 14 Sep 2015 19:28:01 +0000",
"status_id": 11,
"base_shipping_cost": "0.0000",
"shipping_cost_ex_tax": "0.0000",
"shipping_cost_inc_tax": "0.0000",
"base_handling_cost": "0.0000",
"handling_cost_ex_tax": "0.0000",
"handling_cost_inc_tax": "0.0000",
"base_wrapping_cost": "0.0000",
"wrapping_cost_ex_tax": "0.0000",
"wrapping_cost_inc_tax": "0.0000",
"total_ex_tax": "34.0000",
"total_inc_tax": "34.0000",
"items_total": 16,
"items_shipped": 0,
"payment_method": "Manual",
"refunded_amount": "0.0000",
"order_is_digital": "false",
"ip_address": "64.231.103.57",
"geoip_country": "Canada",
"geoip_country_iso2": "CA",
"discount_amount": "0.0000",
"ebay_order_id": 0,
"billing_address": {
"first_name": "Charles",
"last_name": "Delfs",
"company": "Delfs Eng",
"street_1": "50 Moore St.",
"street_2": "Box 1428",
"city": "Bradford",
"state": "Ontario",
"zip": "L3Z 2B7",
"country": "Canada",
"country_iso2": "CA",
"phone": "",
"email": "mrdelfs@gmail.com"
},
"products": [{
"id": 253,
"product_id": 113,
"name": "Hammer and Anvils 6",
"sku": "",
"price_ex_tax": "24.0000",
"price_inc_tax": "24.0000",
"quantity": 1,
"ebay_item_id": "",
"product_options": []
}, {
"id": 254,
"product_id": 113,
"name": "Hammer and Anvils 6",
"sku": "",
"price_ex_tax": "24.0000",
"price_inc_tax": "24.0000",
"quantity": 1,
"ebay_item_id": "",
"product_options": []
}],
"shipping_addresses": []
}
来自 BC 支持的回应... “感谢您联系 Bigcommerce!
“我不想说更新订单行项目的细节很少,因为它目前还没有完全构建出来。有一些方法可以更新现有的行项目 - 类似于您尝试过的方法,但您需要包括如果您想覆盖现有订单项,则为订单中现有产品的“id”参数。但问题是在对现有产品等内容进行更新时,总计计算似乎不正确。我看到了类似的奇怪现象更改现有的送货地址。现在您可以另外更新“total_inc_tax”和“total_ex_tax”以使其准确,但在某些情况下“total_tax”行项目似乎仍然不正确。
这确实是 v2 API 没有正确解决的问题,需要在即将发布的下一个版本中进行处理。与此同时,我的建议是不要以这种方式更新现有订单,而是创建一个新订单并在您需要更新产品或送货地址时丢弃原始订单。更新订单的其他细节似乎不会产生同样的负面影响。
很抱歉,我确定这不是您想听到的。如果您对上述内容有任何疑问,请告诉我,我会尽我所能提供帮助。”
【问题讨论】:
-
请分享您传递的 JSON 对象。
-
添加,这两种产品是以前更新的原始产品。我还通过删除产品“id”键进行了实验
-
您是否真的在尝试更新订单的产品?
-
@developerscott 是的,但显然(很难相信)根据 BC 支持,这是不可能的。很可能有人不理解这个问题。我添加了 BC 支持回复
标签: api e-commerce updates bigcommerce