我發現當我使用BigCommerce API更新訂單的產品訂單項時獲得重複的訂單時。看起來,即使我在訂單更新JSON對象中傳遞了單個訂單項,我也會收到兩個訂單產品(Order Products)。BigCommerce API在更新訂單時創建重複訂單產品線
我將更新呼叫作爲記錄在這裏: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": "[email protected]"
},
"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": []
}
響應...... 「感謝您聯繫的Bigcommerce
!」我不想說更新訂單行項目的細節很稀疏e目前尚未完全建成。有更新現有訂單項的方法 - 類似於您嘗試過的方式,但如果您想覆蓋現有訂單項,則需要在訂單中包含現有產品的「ID」參數。但問題是總計計算在對現有產品等進行更新時看來並不正確。我看到了類似的奇怪現象,對現有的送貨地址進行更改。現在您的爲能夠額外更新「total_inc_tax」和「total_ex_tax」以使其準確無誤,但在某些情況下,「total_tax」訂單項似乎仍然不正確。
這確實是v2 API無法正確解決的問題,需要在即將推出的下一個版本中開展工作。與此同時,我的建議是不以這種方式更新現有訂單,而是如果您需要更新產品或送貨地址,請創建新訂單並清理原件。更新訂單上的其他細節似乎沒有這些相同的消極後果。
我很抱歉,因爲我確定這不是你想聽到的。請告知如果您對以上內容有任何問題,我會盡我所能幫助我知道「
請!分享您傳遞的JSON對象 – developerscott
補充說,這兩個產品是原創的從以前的更新。我也嘗試通過刪除產品「ID」鍵 –
您是否確實試圖更新訂單的產品? – developerscott