I hope someone can help me with my query.
We want to quickly check what the inventory level ID is, and what the current available stock is for a specific SKU, in a specific Location. As far as I could find out with Graphiql is this not possible.
I got the following query:
{ inventoryItems(query:"sku:302.360.25", first:5) { edges { node { id, sku, inventoryLevels(first:5) { edges { node { id, available } } } } } } }
But we are only interested in the stock of 1 specific Location. So it is wasteful to get the first 5 locations and filter it ourselves. But we also found customers with lots of locations, then we should paginate through these items.
I would like to add a query to the inventoryLevels() call, with a specific Location ID. But that does not work.
question: Is this possible and with what query? Or is this the only way for now?
I also tried it with starting at the locations() and then going to the inventoryLevels() and inventoryItems() but then I cannot query for the SKU.
Hi @casperb,
If you already know the location ID you would use inventoryLevel instead:
{ inventoryItems(query:"sku:302.360.25", first:5) { edges { node { id sku inventoryLevel (locationId:"gid://shopify/Location/44073811") { available id } } } } }
Additionally if you have the ID of the item you can do this which is even cleaner:
{ inventoryItem(id: "gid://shopify/InventoryItem/14141944725526") { id sku inventoryLevel(locationId: "gid://shopify/Location/44073811") { available id } } }
Hi @Ryan
Sweet, that first one is exactly what I needed. We indeed know the location ID, because users choose the location they want to manage during the integration.
I will test this in our app.
Subject | Author | Posted |
---|---|---|
4 hours ago | ||
5 hours ago | ||
6 hours ago | ||
6 hours ago | ||
6 hours ago |
User | Count |
---|---|
257 | |
165 | |
134 | |
67 | |
38 |