Skip to main content

Hello,

we use Algolia for indexing and we need to index only the products that have price and that are in stock.

In Algolia it is written:

Custom query predicate

We'll use the query predicate you define here in the product projection endpoint to determine if there's a product to index or not.

Examples:

  • Only index variants with a price under 200:

    variants(prices(value(centAmount < 20000)))
  • Only index products for which the 'Brand' attribute is Algolia:

    masterVariant(attributes(name="Brand" and value="Algolia"))

 

I tried to do

  • variants(availability(isOnStock = true))
  • variants(prices is not empty)
  • masterVariant(availability(isOnStock = true))
  • masterVariant(prices is not empty)

But can’t make it work.

Also tried in HTTP API Playground and for inStock it only worked for me if I wrote:
 

masterVariant(availability(channels(d3f52478-f9d3-4790-829d-cc8ed18b513f(isOnStock = true))))

But that’s not good for me as here I need to know channel ID and I want it to be dynamic and check if it is in stock in any channel.

Any suggestions?

Best regards,

Tomislav Hlevnjak

Hello ​@Tomislav Hlevnjak 

 

Try this 

variants(availability(isOnStock = true))

 

Hope it helps.