Anchor to inventoryLevelinventory
inventoryLevel
query
Returns an InventoryLevel object by ID.
Anchor to Possible returnsPossible returns
- Anchor to InventoryLevelInventory•
Level The quantities of an inventory item that are related to a specific location. Learn more about the relationships between inventory objects.
Was this section helpful?
Get the location, inventory item, and quantities for an inventory level
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
inventoryLevel(id: "gid://shopify/InventoryLevel/523463154?inventory_item_id=30322695") {
id
quantities(names: ["available", "incoming", "committed", "damaged", "on_hand", "quality_control", "reserved", "safety_stock"]) {
name
quantity
}
item {
id
sku
}
location {
id
name
}
}
}`,
);
const data = await response.json();
query {
inventoryLevel(id: "gid://shopify/InventoryLevel/523463154?inventory_item_id=30322695") {
id
quantities(names: ["available", "incoming", "committed", "damaged", "on_hand", "quality_control", "reserved", "safety_stock"]) {
name
quantity
}
item {
id
sku
}
location {
id
name
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query { inventoryLevel(id: \"gid://shopify/InventoryLevel/523463154?inventory_item_id=30322695\") { id quantities(names: [\"available\", \"incoming\", \"committed\", \"damaged\", \"on_hand\", \"quality_control\", \"reserved\", \"safety_stock\"]) { name quantity } item { id sku } location { id name } } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
inventoryLevel(id: "gid://shopify/InventoryLevel/523463154?inventory_item_id=30322695") {
id
quantities(names: ["available", "incoming", "committed", "damaged", "on_hand", "quality_control", "reserved", "safety_stock"]) {
name
quantity
}
item {
id
sku
}
location {
id
name
}
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
inventoryLevel(id: "gid://shopify/InventoryLevel/523463154?inventory_item_id=30322695") {
id
quantities(names: ["available", "incoming", "committed", "damaged", "on_hand", "quality_control", "reserved", "safety_stock"]) {
name
quantity
}
item {
id
sku
}
location {
id
name
}
}
}`,
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
query {
inventoryLevel(id: "gid://shopify/InventoryLevel/523463154?inventory_item_id=30322695") {
id
quantities(names: ["available", "incoming", "committed", "damaged", "on_hand", "quality_control", "reserved", "safety_stock"]) {
name
quantity
}
item {
id
sku
}
location {
id
name
}
}
}
QUERY
response = client.query(query: query)
Response
JSON{
"inventoryLevel": {
"id": "gid://shopify/InventoryLevel/523463154?inventory_item_id=30322695",
"quantities": [
{
"name": "available",
"quantity": 2
},
{
"name": "incoming",
"quantity": 146
},
{
"name": "committed",
"quantity": 1
},
{
"name": "damaged",
"quantity": 0
},
{
"name": "on_hand",
"quantity": 33
},
{
"name": "quality_control",
"quantity": 0
},
{
"name": "reserved",
"quantity": 30