I'm implementing @sandeep shetty shopify api to insert records into my shopify store. I have implemented insertion completely and working fine for my store. I'm facing problem during update. I'm unable to update records that are being inserted in store. I'm updating records as per their id being generated by api after insertion.
Here is my code that i have written for update product.
Array that will pass as parameter in shopify api call.
$product = array
(
"product" => array
(
"variants" => array
(
"price" => $cat['selling_price'],
"inventory_quantity"=>($cat['original_qty']!="") ? $cat['original_qty'] : 'Null',
)
)
);
Code for update product.
$update = $shopify('PUT', "/admin/products/#{id}.json", $product);
I used to provide the ID inside the json data. Code that I use:
$data_string = '
{
"variant": {
"id": "'.$idVar.'",
"option1": "'.$this->input->post('variant').'",
"price": "'.$this->input->post('salesPrice').'",
"inventory_quantity": "'.$this->input->post('stockQty').'"
}
}
';
To update variant I use the following url:
/admin/variants/".$idVar.".json"
Also, use 000000000.json, removing the # symbol.