# Display all or specific variants in product listings (Elasticsearch)

**URL:** <https://forum.litium.com/t/display-all-or-specific-variants-in-product-listings-elasticsearch/1879>\
**Category:** Questions\
**Created:** [February 12, 2021, 3:15pm UTC](https://forum.litium.com/t/display-all-or-specific-variants-in-product-listings-elasticsearch/1879 "2021-02-12T15:15:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![olof.blom](https://avatars.discourse-cdn.com/v4/letter/o/da6949/32.png) [@olof.blom](https://forum.litium.com/u/olof.blom)\
**Post date:** [February 12, 2021, 3:15pm UTC](https://forum.litium.com/t/display-all-or-specific-variants-in-product-listings-elasticsearch/1879/1 "2021-02-12T15:15:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)\
**Post date:** [February 17, 2021, 4:09pm UTC](https://forum.litium.com/t/display-all-or-specific-variants-in-product-listings-elasticsearch/1879/2 "2021-02-17T16:09:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [March 17, 2021, 4:10pm UTC](https://forum.litium.com/t/display-all-or-specific-variants-in-product-listings-elasticsearch/1879/3 "2021-03-17T16:10:23Z")

</div>

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