Filter inventory levels by location and inventory item IDs

Hello,

Using the (deprecated) REST endpoint to GET inventory levels, we can filter by a list of inventory item IDs and a list of location IDs (see InventoryLevel - REST).
However, using the corresponding GraphQL query (inventoryItems - GraphQL Admin) it seems we can only filter by a single (!) inventory item ID and not by location at all (see inventoryItems - GraphQL Admin).

Maybe I’m missing something and there actually is a way to apply both filters using GraphQL?

You can use OR in the inventoryItems query for multiple IDs.

You then apply the location at the inventory level, where you can then specify the inventory states as well.

query InventoryItemList {
  inventoryItems(first: 20, query: "id:30322695 OR id:X") {
    edges {
      node {
        id
        inventoryLevel(locationId: "123") {
          quantities(names: ["available"]) {
            quantity
          }
        }
      }
    }
  }
}
1 Like