StoreFront API products query available_for_sale = true

StoreFront API products query available_for_sale = true

ZoltanDalmadi
Visitor
1 0 0

Hi there,

I have a problem with querying only the products that are in stock.

I use the following query:

products(first: 250, query: "available_for_sale:true", sortKey: BEST_SELLING) {
...
}

I see in the docs that I can include available_for_sale in the query, but it doesn't tell how can we check equality for a boolean value. "available_for_sale:true" doesn't seem to work.

If anyone can help it would be greatly appreciated.

Replies 2 (2)

Alex
Shopify Staff
1561 81 342

Hey @ZoltanDalmadi.

 

I might be misunderstanding, but that query seems to work fine for me on my own shop. Can you be specific in how it's not working, as in are you not getting any results back?

 

Make sure you check that the products are published to the online store channel. Of course let me know if I'm not understanding what you're asking though.

 

Cheers.

Alex | 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 the Shopify Help Center or the Shopify Blog

Peter1983
Shopify Partner
25 0 0

I think you should try the StoreFront API through the POSTMan instead.