Development discussions around Shopify APIs
Hello I am usind PHP curl in order to manage my inventory with Shopify.
Everthing workd fine except for inventory levels. For example:
$url = "https://app:pwd@url.myshopify.com/admin/api/2021-10/inventory_levels/set.json";
$data_json=json_encode(
array(
"inventory_levels/set" => array(
"location_id" => $idlocation,
"inventory_item_id" => $invitem,
"available" => $qty
)
),
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($data_json)));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
I am pretty sure $idlocation, $qty and $invitem are valid real data, I verified that $invitem is an actual integer representing an id of an inventory_item_id.
The response I get (even trying with different approachs) is:
string(72) "{"errors":{"inventory_item_id":"Required parameter missing or invalid"}}"
What does it mean? And how I do pass a valid parameter?
Connect your PayPal account to allow your customers to checkout using the PayPal gateway a...
ByYour online store speed can enhance your store’s discoverability, boost conversion rates a...
ByShopping is at our fingertips with mobile devices. Is your theme optimized to be user-frie...
By