Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Hiding filter values that don't return results

Vote:
 

Forgive me if this is documented and I missed it somehow, but I'm curious how I might be able to hide filter values on a catalog page that don't return results (products).

Example:

Color (filter)

  • Red (5 products)
  • Blue (2 products)
  • Green (0 products)

In the above example, how do I hide (client-side) or prevent rendering (server-side) the "Green" filter value. I can't think of how this might be possible without directly querying each filter value in the Find index to determine result count before rendering the page. That approach seems rather expensive from a performance standpoint, however.

#224773
Jun 25, 2020 21:14
Vote:
 

Hi Ravindra,

Thank you for your response - could you elaborate?

I believe the approach in the article helps with hiding/removing filters that lack any results, but I don't believe it helps solve for hiding filter values that lack any results. Or maybe I'm missing something.

#224832
Edited, Jun 26, 2020 20:53
Vote:
 

Hi Ryan,

I assuming that you are using the methods that are given this article so you can show or hide the filters based on the count.

#224851
Jun 27, 2020 2:55
Vote:
 

@Ryan - can you post the code you use to generate the filters? Normally, there is no need to hide any empty filters, as facets are generated based on items present.

#225117
Jul 06, 2020 7:11
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.