Display all or specific variants in product listings (Elasticsearch)

My customer have have a lot of similar variants for specific product groups and wants the option to select how a product should be displayed in product listings (sometime they want to show all variants and sometimes specific variants)

We have a text option on the base product that defines how a specific product should be displayed in product listings - “Standard”, “Single product” or “Selected variants” (configured with a bool on the variant).

I would like to adjust the product search (Elasticsearch) to include this “filtering” logic when performing a product search. What’s the best practice for this? Where should I hook in?

Litium version: 7.5.0

In this scenario are you still grouping variants on properties as well?

Maybe you could extend the ProductDocument with a property for this, such as ShowInListings and implement the logic you’re describing when the product is being indexed? It defaults to true (=Standard), otherwise it depends on what has been set up.

Then when doing the search you can include a filter for this particular property for product lists and categories.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.