Skip to content

Inventory Lookup

Check product availability at stores, find where products are in stock, and monitor inventory levels.

Two Ways to Check Inventory

From a Product:

graphql
product(sku: "123") {
  inventories { ... }
}

From a Store:

graphql
store(id: "511") {
  inventories { ... }
}

Both support the same filters: latitude, longitude, radiusKm, minQuantity.

Find Stores with Product in Stock

Use case: User views a product detail page and wants to know "Where can I buy this near me?"

graphql
query ProductAvailability(
  $sku: String!
  $latitude: Float!
  $longitude: Float!
  $radiusKm: Float!
) {
  product(sku: $sku) {
    name
    priceInCents
    inventories(
      filters: {
        latitude: $latitude
        longitude: $longitude
        radiusKm: $radiusKm
        minQuantity: 1
      }
      pagination: { first: 20 }
    ) {
      edges {
        node {
          quantity
          updatedAt
          distanceKm
          store {
            externalId
            name
            address
            city
            latitude
            longitude
          }
        }
      }
    }
  }
}

Variables:

json
{
  "sku": "438663",
  "latitude": 43.6532,
  "longitude": -79.3832,
  "radiusKm": 10
}

Results are automatically sorted by distance (nearest stores first).

Inventory Filters

  • latitude, longitude, radiusKm - Find nearby stores with stock (only works with product.inventories)
  • minQuantity - Only show stores with at least X units

The distanceKm field is only populated when using geospatial filters.

Check Store Inventory

Use case: User views a store page and wants to see "What's available at this store?"

graphql
query StoreInventory($storeId: String!) {
  store(id: $storeId) {
    name
    address
    city
    inventories(
      filters: { minQuantity: 1 }
      pagination: { first: 50 }
    ) {
      edges {
        node {
          quantity
          updatedAt
          product {
            sku
          }
        }
      }
    }
  }
}

Variables:

json
{
  "storeId": "511"
}

Results are ordered by quantity (highest stock first).

Inventory Freshness

Inventory data changes frequently. Cache for 15-30 minutes max and display the updatedAt timestamp so users know how fresh the data is.

Find High-Stock Locations

Use case: Business customer needs to buy 10+ cases and wants to know which stores have sufficient stock.

graphql
query HighStockLocations(
  $sku: String!
  $minQuantity: Int!
  $latitude: Float!
  $longitude: Float!
) {
  product(sku: $sku) {
    name
    priceInCents
    inventories(
      filters: {
        latitude: $latitude
        longitude: $longitude
        radiusKm: 50
        minQuantity: $minQuantity
      }
      pagination: { first: 10 }
    ) {
      edges {
        node {
          quantity
          distanceKm
          store {
            externalId
            name
            address
            city
            hasParking
          }
        }
      }
    }
  }
}

Variables:

json
{
  "sku": "438663",
  "minQuantity": 10,
  "latitude": 43.6532,
  "longitude": -79.3832
}

Inventory with Product Details

Use case: Show what's available at a store with full product information.

graphql
query StoreInventoryWithProducts($storeId: String!) {
  store(id: $storeId) {
    name
    address
    productsCount
    inventories(
      filters: { minQuantity: 1 }
      pagination: { first: 30 }
    ) {
      edges {
        node {
          quantity
          updatedAt
          product {
            sku
            name
            priceInCents
            producerName
            thumbnailUrl
            alcoholPercent
            unitVolumeMl
          }
        }
      }
    }
  }
}

Check Multiple Products at Once

Use case: User has a shopping list and wants to check if a store has all items.

graphql
query CheckShoppingList(
  $storeId: String!
  $skus: [String!]!
) {
  store(id: $storeId) {
    name
    address
    inventories(
      filters: { minQuantity: 1 }
      pagination: { first: 100 }
    ) {
      edges {
        node {
          quantity
          updatedAt
          product {
            sku
          }
        }
      }
    }
  }
}

Then filter the returned inventories client-side to check if all SKUs in your list are available.

Real-World Use Cases

"Can I reserve this online?"

Combine product availability with store features:

graphql
query ReservationAvailability($sku: String!, $lat: Float!, $lng: Float!) {
  product(sku: $sku) {
    name
    priceInCents
    inventories(
      filters: {
        latitude: $lat
        longitude: $lng
        radiusKm: 25
        minQuantity: 1
      }
      pagination: { first: 15 }
    ) {
      edges {
        node {
          quantity
          distanceKm
          updatedAt
          store {
            externalId
            name
            address
            hasSameDayPickup
            hasParking
          }
        }
      }
    }
  }
}

Filter results client-side for stores with hasSameDayPickup: true.

"Stock Alert System"

Monitor inventory levels for price alerts or restocking notifications:

graphql
query MonitorInventory($sku: String!) {
  product(sku: $sku) {
    name
    priceInCents
    inventories(
      filters: { minQuantity: 1 }
      pagination: { first: 100 }
    ) {
      edges {
        node {
          quantity
          updatedAt
          store {
            externalId
            name
            city
          }
        }
      }
    }
  }
}

Next Steps