Using GraphQL - can I filter by tracked status of inventory?

Solved
Wayne_Foster
Shopify Partner
7 0 0

Hi,

 

I have a GraphiQL statement - where I am interested in getting the inventory details for just products that we track.

But the query: "tracked:true" is being ignored.  Probably a syntax issue - can anybody help?

{
  inventoryItems(first:10, query:"tracked:true") {
    edges {
      node {
        id
        sku        
        tracked
        inventoryLevel(locationId: "gid://shopify/Location/id") {
          available
          id
          updatedAt
        }
        variant {
          displayName
          barcode
          product {
            title
          }
        }
      }
    }
  }
}

 

 

0 Likes
Greg_Kujawa
Shopify Partner
965 80 205

Looking through the API docs, or the interactive pop-up help in the GraphiQL app, I don't see this field being part of the provided query parameters. Confirmed below. 

Untitled.png

0 Likes
Wayne_Foster
Shopify Partner
7 0 0

so we pull all the data - then filter within our own application - is that the only approach?

0 Likes
Greg_Kujawa
Shopify Partner
965 80 205

This is an accepted solution.

Usually that's what I wind up doing if I can't narrow things down enough with query parameters. Not the most efficient solution but it works!