Issue with "query" parameter in Product Variant GraphQL Query – Works for Some Shops, But Not Others

Hello Shopify Developers,

I’m currently facing an issue with the GraphQL query for fetching product variants. I’m using the following query to filter products based on their status:

product_status:active AND publishable_status:online_store_channel AND managed_by:shopify AND inventory_quantity:<=0

For some shops, this query works perfectly and returns the expected results. However, for others, it returns an empty response with no data.

Has anyone encountered a similar issue with the “query” parameter in the Product Variant GraphQL query? What might cause this inconsistency, and how can I resolve it?

I’d appreciate any guidance or insight you can offer.

Thank you!

Hi @asm97

From the query parameters, there is no problem. Is it because there is no data that meets the query criteria that the returned data is empty? If the query does not return an error, it is speculated that there is a data problem

I tried using the query inventory_quantity:<=0, and I’m confident that there is data matching this condition. However, the search returns no results. I’ve also checked the extensions section, and there are no errors there.

This issue is happening for just one of our shops, while the other shops are working fine. Has anyone experienced something similar or have suggestions on what might be causing this?"

Are there products that haven’t been configured for inventory? I mean, those for which inventory tracking hasn’t been set up.

no, the result shows there are tracked:true

 {'id': 'gid://shopify/ProductVariant/552460068*****',
   'product': {'id': 'gid://shopify/Product/150967625*****',
    'tags': [],
    'status': 'ACTIVE'},
   'inventoryQuantity': 0,
   'inventoryPolicy': 'CONTINUE',
   'inventoryItem': {'tracked': True,
    'id': 'gid://shopify/InventoryItem/53841536*****'}},

I once encountered a similar problem. The reason was that this store didn’t have the permissions for certain fields. You can also check this.

The raw query (without the search query) returns ‘OK’. Could you clarify which specific permissions you’re referring to? I’ll check that as well.