fork download
  1. // Shopify Order Update Script
  2. $orderId = 6089155313859;
  3. $accessToken = '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';
  4. $shopUrl = "https://t...content-available-to-author-only...y.com";
  5. $apiVersion = "2025-04";
  6.  
  7. $note_attributes = array(
  8. array('name' => 'Payment Gateway', 'value' => '-'),
  9. array('name' => 'PG Order ID', 'value' => '-'),
  10. array('name' => 'Coupons', 'value' => '-'),
  11. array('name' => 'FlexyPe Session ID', 'value' => '8205ee65-11f7-4234-be47-7de2ff9e15d3'),
  12. array('name' => 'Landing Page', 'value' => '/'),
  13. array('name' => 'Referer', 'value' => 'direct'),
  14. array('name' => '_y', 'value' => 'FEDBB518-780e-4FC1-97e9-d23c32d7c4e8'),
  15. array('name' => 'from', 'value' => 'new-customer-accounts'),
  16. array('name' => 'Delivery Date - Ultra Lite Japanese Cheese Cake - 8022859120835', 'value' => '10-06-2025'),
  17. array('name' => 'Delivery Time Slot - Ultra Lite Japanese Cheese Cake - 8022859120835', 'value' => '03:00pm-05:00pm')
  18. );
  19.  
  20. $headers = array(
  21. 'Content-Type: application/json',
  22. 'X-Shopify-Access-Token: ' . $accessToken
  23. );
  24.  
  25. $putData = json_encode(array(
  26. 'order' => array(
  27. 'id' => $orderId,
  28. 'note_attributes' => $note_attributes
  29. )
  30. ));
  31.  
  32. $putCurl = curl_init();
  33. CURLOPT_URL => $shopUrl . "/admin/api/" . $apiVersion . "/orders/" . $orderId . ".json",
  34. CURLOPT_RETURNTRANSFER => true,
  35. CURLOPT_CUSTOMREQUEST => "PUT",
  36. CURLOPT_HTTPHEADER => $headers,
  37. CURLOPT_POSTFIELDS => $putData,
  38. CURLOPT_SSL_VERIFYPEER => false,
  39. CURLOPT_SSL_VERIFYHOST => false,
  40. ));
  41.  
  42. $putResponse = curl_exec($putCurl);
  43. $putResult = json_decode($putResponse, true);
  44.  
  45. echo "Response: " . $putResponse . "\n";
  46. print_r($putResult);
  47.  
  48. curl_close($putCurl);
Success #stdin #stdout 0.02s 25488KB
stdin
Standard input is empty
stdout
// Shopify Order Update Script
$orderId = 6089155313859;
$accessToken = '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';
$shopUrl = "https://t...content-available-to-author-only...y.com";
$apiVersion = "2025-04";

$note_attributes = array(
    array('name' => 'Payment Gateway', 'value' => '-'),
    array('name' => 'PG Order ID', 'value' => '-'),
    array('name' => 'Coupons', 'value' => '-'),
    array('name' => 'FlexyPe Session ID', 'value' => '8205ee65-11f7-4234-be47-7de2ff9e15d3'),
    array('name' => 'Landing Page', 'value' => '/'),
    array('name' => 'Referer', 'value' => 'direct'),
    array('name' => '_y', 'value' => 'FEDBB518-780e-4FC1-97e9-d23c32d7c4e8'),
    array('name' => 'from', 'value' => 'new-customer-accounts'),
    array('name' => 'Delivery Date - Ultra Lite Japanese Cheese Cake - 8022859120835', 'value' => '10-06-2025'),
    array('name' => 'Delivery Time Slot - Ultra Lite Japanese Cheese Cake - 8022859120835', 'value' => '03:00pm-05:00pm')
);

$headers = array(
    'Content-Type: application/json',
    'X-Shopify-Access-Token: ' . $accessToken
);

$putData = json_encode(array(
    'order' => array(
        'id' => $orderId,
        'note_attributes' => $note_attributes
    )
));

$putCurl = curl_init();
curl_setopt_array($putCurl, array(
    CURLOPT_URL => $shopUrl . "/admin/api/" . $apiVersion . "/orders/" . $orderId . ".json",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_POSTFIELDS => $putData,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => false,
));

$putResponse = curl_exec($putCurl);
$putResult = json_decode($putResponse, true);

echo "Response: " . $putResponse . "\n";
print_r($putResult);

curl_close($putCurl);