Staying on top of your inventory levels is critical to running a successful retail business. Too much stock is an inefficient use of your capital; too little stock risks missing out on sales and disappointing your customer base.
You can use Shopify’s GraphQL API to retrieve a list of all of your products and their inventory, broken out by SKU and which store / warehouse the product is currently being held in.
If you just want the end result, scroll to the end. Otherwise, read on to learn how to use GraphQL.
The query
GraphQL was invented by Facebook to describe arbitrarily complex relationships between people, pages, and posts. It’s been adopted throughout the tech industry, including at Shopify.
It’s very powerful, but can be challenging to work with. The below example:
- is a read-only query (indicated by the
query
at the top)
- enumerates all of your product variants (see Shopify’s documentation for a list of all the other possible things you can query)
- for each variant, it fetches:
- a cursor, so that we can paginate across all of your variants, in case there are too many for one a single response
- details about the variant like its display name and SKU
- details about the stock levels of the variant, including which location it’s currently stored in
query ($after: String) { productVariants(first:10, after: $after) { edges { cursor node { id displayName sku inventoryItem { locationsCount inventoryLevels(first: 10) { edges { node { available location { name isActive shipsInventory } } } } } } } } }
As you can see, that’s a lot! Luckily, we’ve done the heavy lifting for you — you should be able to take this query for a spin easily by using the form below.
Try it on your own store now
Shopify Inventory by SKU and Location
Please fill in any necessary fields and click Run.
POST
Preview
View the API data, get a live Google Sheet dashboard
Name | SKU | Available | Location Name |
---|---|---|---|
Get a live Google Sheet
Export your data to a google sheet, with the SyncWith Addon, or download to CSV
Automatically updated
Schedule your data to update hourly or daily
Add data sources
Import additional data from other apps
Build reports & dashboards
Easily build live reports within Google Sheets