Liquid, Javascript, thèmes
I am using the code below to create fullfilment for orders in Shopify this code was working correctly till last weeks sudenly it stops working I have tried many solution but nothing is clear since the response is always BLANK.
$data = array( "fulfillment" => array( "tracking_number" => $tracking_id, "location_id" => "56530665662", "tracking_url" => "https://yalidine.com/suivre-un-colis/?tracking=".$tracking_id, "tracking_company" => "Yalidine" ) ); $data_string = json_encode($data); $ch_shopify = curl_init('https://'.$shopify_api_key.':'.$shopify_api_password.'@'.$shop_name.'.myshopify.com/admin/orders/'.$order_id.'/fulfillments.json'); curl_setopt($ch_shopify, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string)) ); curl_setopt($ch_shopify, CURLOPT_POST, 1); curl_setopt($ch_shopify, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch_shopify, CURLOPT_RETURNTRANSFER, true); $response_shopify = curl_exec($ch_shopify); // $result_shopify = json_decode(trim($response_shopify),true); // print_r( "<br/>response: ".$response_shopify); // print_r( "<br/>fulfillment: ".$result_shopify['fulfillment']); // print_r ("<br/>errors: ".$result_shopify['errors']['base']); // $fulfillment = $result['fulfillment']; $resp_array = json_decode(trim($response_shopify), TRUE); echo("*************************"); print_r($response_shopify); $fulfillment = strval($resp_array['fulfillment']['status']); // print_r("fulfillment: ".$fulfillment); if ($resp_array['errors']['base'][0] == "Line items are already fulfilled" || $fulfillment == "success") { $_SESSION['response'] = $order_number; header("Location: index.php"); exit(); }else { $_SESSION['error'] = $resp_array; echo "resp_array: ".$resp_array; } $data = array( "fulfillment" => array( "tracking_number" => $tracking_id, "location_id" => "56530665662", "tracking_url" => "https://yalidine.com/suivre-un-colis/?tracking=".$tracking_id, "tracking_company" => "Yalidine" ) ); $data_string = json_encode($data); $ch_shopify = curl_init('https://'.$shopify_api_key.':'.$shopify_api_password.'@'.$shop_name.'.myshopify.com/admin/orders/'.$order_id.'/fulfillments.json'); curl_setopt($ch_shopify, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($data_string)) ); curl_setopt($ch_shopify, CURLOPT_POST, 1); curl_setopt($ch_shopify, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch_shopify, CURLOPT_RETURNTRANSFER, true); $response_shopify = curl_exec($ch_shopify); // $result_shopify = json_decode(trim($response_shopify),true); // print_r( "<br/>response: ".$response_shopify); // print_r( "<br/>fulfillment: ".$result_shopify['fulfillment']); // print_r ("<br/>errors: ".$result_shopify['errors']['base']); // $fulfillment = $result['fulfillment']; $resp_array = json_decode(trim($response_shopify), TRUE); echo("*************************"); print_r($response_shopify); $fulfillment = strval($resp_array['fulfillment']['status']); // print_r("fulfillment: ".$fulfillment); if ($resp_array['errors']['base'][0] == "Line items are already fulfilled" || $fulfillment == "success") { $_SESSION['response'] = $order_number; header("Location: index.php"); exit(); }else { $_SESSION['error'] = $resp_array; echo "resp_array: ".$resp_array; }
Bonjour, Depuis quelque temps, nous nous attachons à améliorer l’expérience Shopify e...
By Shopify May 12, 2025Maîtrisez l’expansion internationale de votre activité Shopify grâce au parcours d’appr...
By Shopify Feb 7, 2025Agrandissez la vente en gros avec le parcours d’apprentissage de Shopify Academy, B2B...
By Shopify Jan 30, 2025