query with more than one param doesnt work

nikhilyayloh
Shopify Partner
4 0 0

Hi, 

 

I am trying to fetch products which have positive inventory quantity among the list of product ids. 

But my query below does not return any results. 

{
        productVariants(first: 10, query: "(inventory_quantity:>0) AND (product_ids:7483474804973,7483550007533)") {
            edges {
                node {
                    id
                    image {
                        url
                    }
                    product{
                        id
                    }
                    availableForSale
                    inventoryQuantity
                    price
                    selectedOptions {
                        name
                        value
                    }
                }
            }
        }
        }

 

But if i would run the above query with either inventory condition or product_ids only, then i get results. 

What am i doing wrong here?

 

Big thanks for help.

Replies 6 (6)

Liam
Shopify Staff
2731 298 769

Hi Nikhilyayloh

 

Can you try:

query: "(inventoryQuantity:>'0') AND (product_ids:xxxx,xxxx)")

The above worked when I tested in the graphiql app.

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

nikhilyayloh
Shopify Partner
4 0 0

Hi Liam, 

It might execute and give results but if you increase the inventory value from 0 to say 100K, you will see that it doesnt filter out data. So that condition itself is not used. Plus inventory_quantity is the query field mentioned in the documentation.

 

Liam
Shopify Staff
2731 298 769

I see what you mean - other filters like vendor appear to work as expected alongside product_ids but inventory_quantity is not - I'll dig into this a bit more.

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Liam
Shopify Staff
2731 298 769

Hi Nikhilyayloh,

 

We've identified this is a bug on our side and will be shipping a fix asap.

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

nikhilyayloh
Shopify Partner
4 0 0

Hi, 

Is there a timeline for this fix? 

ShopifyDevSup
Shopify Staff
1312 215 454

Hey @nikhilyayloh

 

Thanks for checking in. The issue hasn't been resolved as of yet. Currently we don't have firm deadline or timeline for a fix but it is still on the radar with our development teams. 

 

Kind Regards,

- Kyle G.
 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog