【发布时间】:2018-01-12 12:53:55
【问题描述】:
我使用的是 Magento 2.2.2 版本。我正在尝试通过他们的 rest API 更新跟踪信息。这是我的代码:
$tracking_str =
'{
"items": [
{
"extension_attributes": {},
"order_item_id": "'.$orderItemId.'",
"qty": "'.$qty_invoiced.'"
}
],
"notify": false,
"appendComment": true,
"comment": {
"extension_attributes": {},
"comment": "Item(s) has been shipped",
"is_visible_on_front": 0
},
"tracks": [
{
"extension_attributes": {},
"track_number": "'.$TrackingNumber.'",
"title": "'.$ShipTitle.'",
"carrier_code": "'.$carrierCode.'"
}
],
"packages": [
{
"extension_attributes": {}
}
],
"arguments": {
"extension_attributes": {}
}
}';
我将上述内容传递给 php curl,我第一次收到货件 ID 的响应。并且订单状态正在通过 Magento API 更改为“完成”。但是,承运人代码和跟踪号等跟踪信息不会更新。当我再次运行代码时,我得到的响应是:
res is: stdClass Object
( [message] => Shipment Document Validation Error(s):
The order does not allow a shipment to be created.
You can't create a shipment without products.
)
我不知道,我哪里出错了。
【问题讨论】: