inventoryLevel
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.
- can
Deactivate •Boolean!non-null Whether the inventory items associated with the inventory level can be deactivated.
- created
At •Datenon-nullTime! The date and time when the inventory level was created.
- deactivation
Alert •String Describes either the impact of deactivating the inventory level, or why the inventory level can't be deactivated.
- id•ID!non-null
A globally-unique ID.
- item•Inventorynon-null
Item! Inventory item associated with the inventory level.
- location•Location!non-null
The location associated with the inventory level.
- quantities•[Inventorynon-null
Quantity!]! Quantities for the requested names.
- scheduled
Changes • Inventorynon-nullScheduled Change Connection! Scheduled changes for the requested quantity names.
- updated
At •Datenon-nullTime! The date and time when the inventory level was updated.
- can
Get the location, inventory item, and quantities for an inventory level
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-07/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)