Shopify - which variant will be shown with the product? Any rule?

I have installed Algolia and I am showing products instead of variants.
In this case, I see the products are showing with the one variant.
But I am not sure which variant will be shown with the product.
Is there any rule?

Hi @yudechen

As mentioned, you activated “Show product instead of variant”, so Algolia displays the image of the product.

During indexation the image selected as the “product image” to display is the product variant that fits the index “Ranking and sorting” configured for the targeted index, which sometimes is not the “proper” one you want (depending of the current search query).

One approach is to update a file that our Plugin injected in your theme: algolia_helpers.js.liquid.

Please do replace, line 133 (for ISv4) or 123 (for ISv1).:

var image = this._distinct ? this.product_image : this.image;

By

var image = this.image;

Then, save.