Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 通过shopify API完成订单_Php_Api_Shopify_Fulfillment - Fatal编程技术网

Php 通过shopify API完成订单

Php 通过shopify API完成订单,php,api,shopify,fulfillment,Php,Api,Shopify,Fulfillment,我在shopify上有一个测试商店。创建订单时,我希望通过PHP API调用将订单的履行状态更新为“履行” 到目前为止,文件中未提及更新订单中行项目的履行状态 有什么办法吗?有。API实现是可能的:这就是我现在的工作方式 $data = array( "fulfillment" => array("tracking_number" => "1111111111")); $data_string = json_encode($data);

我在shopify上有一个测试商店。创建订单时,我希望通过PHP API调用将订单的履行状态更新为“履行”

到目前为止,文件中未提及更新订单中行项目的履行状态


有什么办法吗?

有。API实现是可能的:

这就是我现在的工作方式

$data = array( "fulfillment" => array("tracking_number" => "1111111111"));

$data_string = json_encode($data);                                                                                   

$ch = curl_init('https://API:PASS@STORE.myshopify.com/admin/orders/ORDER_ID/fulfillments.json');
curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                                                          
    'Content-Type: application/json',                                                                                
    'Content-Length: ' . strlen($data_string))                                                                       
);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);
print_r($result);