The World’s Largest Online Community for Developers
I am using the 'PHP Classic' PHP wrapper for the Shopify API
Per the Shopify API documentation for the current API version (2020-01) illustrating the way inventory level relates to location and specific item: each product variant has a 1:1 relationship with an attribute
inventory_item_id. An inventory level (count of inventory for that item) connects to one location and one
Things I think I know:
Using the PHPClassic wrapper for Shopify API you can access API endpoints in the following way:
$product = $shopify->Product(12345678)->get();
Will get you the information about product with id 12345678.
Similarly you can get child resources of endpoints like this:
$productID = 23564666666; $productImages = $shopify->Product($productID)->Image->get();
What I am trying to do but don't know how:
I want to retrieve the inventory level for an item at a known location and with a known inventory item id, my current code below returns no result (empty). I can't tell if Inventory Level is a child of location or of inventory_item_id but I've tried a few ways of configuring the request including:
$d = [ 'inventory_item_id' => 1234567, 'location_id' => 1234567 ]; $res = $shopify->InventoryLevel->get($d);
Print_r of $res is empty. How can I do this?