Overview
In Shopify, inventory is not stored directly as a simple integer property on ProductVariant. Instead, Shopify uses a normalized 3-part relational structure:
ProductVariant
└── InventoryItem
└── InventoryLevel (Quantity per Location)
Core Entities
ProductVariant: Commercial purchasing option shown to customers.InventoryItem: Internal physical item record representing cost, tracked flag, country of origin, and harmonized system (HS) codes.InventoryLevel: The join record storing the actual quantity at a specific physicalLocation.
GraphQL API Query
To query inventory across locations in Shopify Admin GraphQL API:
query getVariantInventory($id: ID!) {
productVariant(id: $id) {
id
title
sku
inventoryItem {
id
tracked
unitCost {
amount
}
inventoryLevels(first: 5) {
edges {
node {
location {
name
}
quantities(names: ["available", "committed", "on_hand"]) {
name
quantity
}
}
}
}
}
}
}
Inventory Quantities API
In modern Shopify GraphQL APIs, quantities are categorized explicitly by name:
available: Stock ready for immediate purchase.committed: Stock allocated to unfulfilled orders.on_hand: Total physical units present at the location (on_hand = available + committed).reserved: Units set aside for drafts or active holds.
Developer Takeaway
Inventory Adjustments: To update stock quantities programmatically, use Shopify's inventoryAdjustQuantities or inventorySetQuantities GraphQL mutations, supplying the inventoryItemId and locationId.