GraphQL Storefront API updates - Variant-level inventory!
timestamp1590707040001
API
Storefront API
Enhancement
New features
- You may now request inventory levels for each product variant. Note that inventory levels will NOT be returned if your store settings are set to not display stock levels on the storefront.
Consider this query:
query productAndVariantInventory {
site {
products(first: 3) {
edges {
cursor
node {
entityId
name
inventory {
isInStock
hasVariantInventory
aggregated {
availableToSell
warningLevel
}
}
variants(first:5) {
edges {
node {
sku
inventory {
aggregated {
availableToSell
warningLevel
}
}
}
}
}
}
}
}
}
}