Shopify update inventory API tutorial (2026): build a real inventory manager inside your Shopify app with the GraphQL Admin API 2026-10 – read inventory levels per location, adjust and set stock, move stock between locations, and add, rename, deactivate and delete locations, on a real development store. Shopify app development series, episode 5 – everything shown is real, nothing skipped.
What you'll learn
- Inventory items, levels and named quantities (available, committed, on_hand, incoming)
- inventoryAdjustQuantities + inventorySetQuantities
- Why @idempotent and changeFromQuantity are now required (real errors shown)
- CHANGE_FROM_QUANTITY_STALE: why a repeated request can't change stock twice
- Move stock between locations in one call
- locationAdd, locationEdit, locationDeactivate (destinationLocationId), locationDelete
- Polaris web components
💻 Free source code for this episode: github.com/fayyaz315/shopify-app-development-2026/tree/ep05
Chapters
- 0:00 Preview + intro
- 0:36 How Shopify stores stock
- 1:30 The inventory page
- 2:19 Read: locations and levels
- 3:08 The 2026 rules
- 4:24 Adjust stock
- 5:53 Set after a count
- 6:52 Add a location
- 7:24 Move stock between locations
- 8:46 Rename, deactivate, delete
- 9:32 Honest notes
- 10:17 Recap
Step by step (full walkthrough)
Preview + intro
In the next ten minutes, you'll change real stock from inside your own Shopify app. Add units, open a new warehouse and move stock into it, and see why Shopify now refuses inventory calls that worked last year. This is the Shopify update inventory API, running inside our own app.
Ten units received, and the stock went from five to fifteen. This is episode five of the Shopify app development series. Products, variants and collections are done.
Today: stock, and the places it lives. The full code is free on GitHub, and the link is in the description.
How Shopify stores stock
First, how Shopify stores stock. It's not a number on the product. Every variant has one inventory item.
That's the thing you count. Stock sits at a location: your shop, a warehouse, a pop-up store. And one item at one location is an inventory level.
That's where the numbers are. A level has named quantities. The four you'll use most: Available is what customers can still buy.
Committed is already promised to orders that aren't fulfilled yet. On hand is what's physically on the shelf, and incoming is on its way to you. There are more names, like reserved, damaged and safety stock.
Today we stick to available. When you add stock to available, Shopify moves on hand with it. You'll see both change in the real response later.
The inventory page
Now our app. There's a new Inventory page: the stock at one location, with adjust, set and move on every row. A new page is a new file.
The route file app.inventory becomes the URL /app/inventory. And the menu link is one line in the app layout. This episode needs two new permissions: write inventory and write locations, in shopify.app.toml.
A write scope includes reading, so the app can also read stock and locations with these two. A real gotcha: my running dev server didn't pick up the new scopes. I had to restart it, then open the app once to accept them.
Every request takes the same path as before: the page asks the loader, buttons call the action, both talk to the Admin API.
Read: locations and levels
Reading comes first. The locations query lists every location, active or not. Then the stock query.
For each variant: its inventory item, and the level at the location we're looking at. The quantities field takes the names you want: available, on hand and committed. If an item isn't stocked at that location, the level is simply null.
The page shows not stocked. And the list of quantities becomes a small object, name to number, so the table can just say available, on hand, committed. And the loader picks the location from the URL.
Without one, it takes the oldest active location, your main shop. That line is a real fix. At first I sorted by name, and a new warehouse called Austin quietly became the default page.
The 2026 rules
Before we change anything, here's the same read in GraphiQL, so you see Shopify's real response. The weekender bag at the shop location: five available, nothing committed, five on hand, nothing incoming. Now the old way to add stock: inventoryAdjustQuantities, with only the input.
Like most tutorials still show it. Refused. The idempotent directive is required for this mutation but was not provided.
So we add @idempotent with a key. A key is a unique name for this one change. And we must send changeFromQuantity: the number we think is there now.
I pretend we saw three, but the real number is five. Shopify refuses: changeFromQuantity stale. That's the point.
If someone sold a bag since you loaded the page, your change would be based on old numbers. Shopify stops it instead of guessing. With the right number, five, and a new key, plus ten received.
It works. Two changes: available plus ten, and on hand plus ten. Exactly the rule from the start.
And if you forget changeFromQuantity completely, it's refused too. I tested it: the input must include it.
Adjust stock
Back in the app, that's the adjust button. The bag has five. I type ten, and the reason is received.
Adjust. The toast says adjusted by ten, and the row now shows fifteen available and fifteen on hand. Here's the mutation in our file.
Notice the key variable, and the @idempotent directive right after the input. In the action, every request gets a brand new key from crypto.random UUID. Why new?
I tested reusing a key with different numbers. Shopify answers: idempotency key parameter mismatch. The adjust case sends the delta, the reason, and changeFromQuantity: the available number the page showed.
Each change also carries a referenceDocumentUri: a link to whatever caused it, like an order or a stock count. Ours is an app ID with the key. Reasons are fixed words like received, correction, damaged or shrinkage.
They show up in Shopify's inventory history. On the page, the adjust form is a Polaris modal: a number field for the change, and a select for the reason. After every save, a toast, and the modals close.
React Router runs the loader again by itself, so the numbers are always fresh. And when Shopify refuses, like a stale quantity, the toast shows Shopify's own message in red. The user knows the stock changed underneath them.
Set after a count
Adjust is for changes. Set is for counts. The bomber jacket says nine, but I counted seven on the shelf.
Save, and it's seven. I didn't calculate minus two. I sent the number I counted.
That's inventorySetQuantities. Same rules: a key, and changeFromQuantity. The input has quantities instead of changes: the new number, and the number we saw before.
In GraphiQL, I set the bag back to five, from fifteen. Shopify works out the difference for us: minus ten, on both available and on hand. Now the interesting part.
I send the exact same request again, same key, same input. Like a network retry. Refused as stale.
The bag isn't fifteen anymore, so the second request can't change the stock again. And reading it again: five. One change, not two.
Add a location
Next, locations. Add location opens a form. Austin Warehouse, five hundred Congress Avenue, Austin, and the country code.
Add, and the toast says added Austin Warehouse. Down in the locations table: the shop location and Austin, both active. That's locationAdd: a name, an address, and whether it fulfillsOnlineOrders.
The action fills the address from the form. Address, city, postal code and country code.
Move stock between locations
Now move six bags to Austin. Move, pick the location, six units. Moved six.
Fifteen minus six: nine left at the shop. The move form only offers the other active locations, and the units field stops at what's available here. A move is one adjust call with two changes: minus six here, plus six there.
One request, one entry in the inventory history. And the plus side needs its own changeFromQuantity, so the action reads the destination level first. Not stocked there yet counts as zero.
I tested it: you can move stock to a location that has never held the item. Shopify starts stocking it there by itself. Switch the page to Austin Warehouse.
Only the bag is stocked here: six. Everything else says not stocked. The location picker just changes the URL to question mark location equals the ID.
Same change event hook as in episode four. Stock here starts tracking an item at this location. The beanie now shows zero, with adjust, set and move.
That's inventoryActivate, and yes, it needs a key as well. In the table, a stocked row gets the three buttons. A row with no level gets stock here.
Rename, deactivate, delete
Last, the location's life cycle. Rename opens the same form with just the name. Austin Pop-up.
Saved. Deactivate. And look what happens to the page.
It's back on the shop location, and the bag shows fifteen again. The six bags came home. That's because the action sends a destination location.
Shopify moves the stock there before it deactivates. Without a destination, I tested it: the location deactivates, but the stock stays behind, and you can't delete it anymore. Delete is only possible now, on an inactive, empty location.
Gone. Shopify's errors explain the rules: location is active, or location has inventory.
Honest notes
A few honest notes before the recap. One: I load twelve variants. A real store needs pagination, like the products page in episode two.
Two: these mutations only work for tracked items. Untracked items have no quantities to change. Three: moving stock between real warehouses with shipping and receiving is a different API, inventory transfers.
This is the quick version. Want to practise? Add a damaged button that moves units from available to damaged with inventoryMoveQuantities, or show every location side by side.
And everything you saw was tested on my real development store on API version 2026-10, before I pressed record.
Recap
So, the recap. Read stock as inventory levels: an item at a location, with named quantities. Change it with inventoryAdjustQuantities or inventorySetQuantities.
Always with a key, and changeFromQuantity. And manage locations with add, edit, deactivate with a destination, and delete. That's the Shopify update inventory API in 2026, inside a real app, on a real store.
The full code for this episode is free on GitHub. The link is in the description. Next episode: discounts.
Codes, automatic discounts, and buy X get Y. See you there.
Quick fixes from this episode (60-second Shorts)
Shopify Inventory API 2026: @idempotent Is Now Required
Shopify inventory API GraphQL (2026-10): inventoryAdjustQuantities now needs the @idempotent directive with a key AND changeFromQuantity. Without them Shopify refuses the request – real errors shown, then the working call.
Shopify GraphQL Inventory Set Quantities: Why My Retry Was Refused
Shopify GraphQL inventory set quantities (2026-10): set the counted stock with inventorySetQuantities and changeFromQuantity. I sent the same request twice – the second was refused as CHANGE_FROM_QUANTITY_STALE, so the stock never changed twice.
Shopify Locations API: Move Stock Between Locations in One Call
Shopify locations API (GraphQL 2026-10): add a location, move stock into it with ONE inventoryAdjustQuantities call (minus here, plus there), then deactivate it with destinationLocationId so the stock comes home.
The Shopify App Development 2026 series
All episodes are free, with the code on GitHub. Course page: Shopify App Development 2026.
- Episode 1: How to Create a Shopify App in 2026 (Shopify CLI Step by Step for Beginners)
- Episode 2: Shopify Admin API Tutorial 2026
- Episode 3: Shopify Product Variants API 2026
- Episode 4: Shopify GraphQL Create Collection 2026
- Episode 5: Shopify Update Inventory API 2026 (this episode)
- Episode 6: Shopify Create Discount Code API 2026
🔔 New episodes every week on the YouTube channel. Need a custom Shopify app or API integration? Wixob Technologies builds them: info@wixob.com.
[…] Shopify Update Inventory API 2026: Adjust, Set & Move Stock with GraphQL in Your App – Wi… says: November 27, 2026 at 5:04 am […]