【发布时间】:2016-02-16 03:36:49
【问题描述】:
我正在尝试使用 API 为订单创建履行,该履行应包括跟踪号。我将跟踪号与请求一起传递,并且请求显示成功(订单在管理员中正确履行)。但是,我传递的跟踪号从不存在。
我不包括订单项(以履行订单中的所有项目),尽管我已经尝试过两种方式(一次履行一项)
//$id, $key and $password are set previously
$endpoint = "https://{$key}:{$password}@mystore.shopify.com/admin/orders/{$id}/fulfillments.json";
$fulfillment = array(
'fulfillment' => array(
'tracking_number' => '12345'
)
);
$ch = curl_init($endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fulfillment));
res = curl_exec($ch);
运行上述代码后,$res 包含类似这样的内容:
{"fulfillment":{"created_at":"2012-10-22T16:57:53-04:00","id":69428396,"order_id":143675378,"service":"manual","status":"success","tracking_company":null,"tracking_number":null,"tracking_url":"http://www.google.com/search?q=","updated_at":"2012-10-22T16:57:53-04:00","receipt":{},"line_items":[{"fulfillment_service":"manual","fulfillment_status":"fulfilled","grams":0,"id":233975006,"price":"19.00","product_id":108718266,"quantity":1,"requires_shipping":true,"sku":"","title":"Profound grid-enabled intranet","variant_id":248446746,"variant_title":null,"vendor":"Shopify","name":"Profound grid-enabled intranet","variant_inventory_management":null,"properties":[]},{"fulfillment_service":"manual","fulfillment_status":"fulfilled","grams":0,"id":233975008,"price":"19.00","product_id":108718276,"quantity":2,"requires_shipping":true,"sku":"","title":"Operative multi-tasking task-force","variant_id":248446754,"variant_title":null,"vendor":"Shopify","name":"Operative multi-tasking task-force","variant_inventory_management":null,"properties":[]}]}}
您可以在该响应中看到,订单项的履行状态设置为已履行(正确),但 tracking_number 为空(不正确)。
非常感谢任何帮助!
【问题讨论】:
-
请发布您生成的 JSON 以及您用来帮助我们调试问题的 API 密钥。谢谢!
标签: shopify profound-grid