Results that don't match the Query - productVariants with inventory_quantity

I’m making a query for variants with a quantity of 2 - most results do indeed have inventory of 2 but there’s also results with a totally different inventory included. Why is this happening?

query GetActiveProductVariants {
  productVariants(first: 50, query: "inventory_quantity:2") {
    edges {
      node {
        id
        title
        inventoryQuantity
        product {
          title
          vendor
        }
      }
    }
  }
}

I’ve tried variants of the query and either the same result or an error.

The query field is in my experience the last thing that you should be using for querying the fields. It’s never 100% accurate. I usually make if condition after query to remove any wrong product/variant/item.

That being said, the inventory_quantity could give you the wrong result if by any chance you have multiple inventory locations and on one of them you have 2 item qty

@Andrija_Obradovic you’re right, it’s looking at the individual locations - one of which has an inventory of 2. Thank you.