I Can't Update Products in Shopify Using PHP
I want to update the version of products, but the following code doesn't work:
$shopify = shopify\client($store, SHOPIFY_APP_API_KEY, $access_token);
$product_array = array(
'id' => 37247835908,
'price' => "75.00"
);
$put = $shopify('PUT', '/admin/products/632910392.json',array(),$product_array);
print_r($put);
If anyone has an answer to this question then answer me thanks.
+3
source to share
1 answer
I got the answer to this question:
$shopify = shopify\client($store, SHOPIFY_APP_API_KEY, $access_token);
$product_array = array(
'id' => 37247835908,
'price' => "75.00"
);
$put = $shopify('PUT', '/admin/products/632910392.json',array(),$product_array);
print_r($put);
I can replace the query above as shown below and get a solution:
$product_array = array(
'variant'=>array(
'id'=>#{id},
'price'=>15.00
));
$put = $shopify('PUT /admin/variants/#{id}.json',array(),$product_array);
And I have successfully updated the option price.
+4
source to share