Toggle Refinement

2020-08-21 10_36_39-Shims - Search

How can I only let one toggle be selected at a time?

Hi @mgaytan, could you explain your use case? The toggle refinement is usually attached to a boolean attribute that shows whether the value of the attribute is true or false. Could you explain how you are using the widget?

@cindy.cullen Yes I’m using it in an B2B E-commerce, where we have product that is only in Moreno Valley and other in Atlanta and our customers sometimes just want to know all the product that we have in Moreno Valley and not in Atlanta. Does that make sense?

Is it possible that i’m using the wrong widget?

Hi @mgaytan, Thanks for the clarification. The toggle refinement is good for items that have just two states, such as in stock or out of stock. They are mutually exclusive though, so there’s no way out of the box to let one toggle refinement widget depend on another.

You could use the refinementList widget which would list all three stores, and then let them filter by store as seen in this codesandbox which has a facet by brand. If you had a facet by location, the refinement list would list the three locations and clicking one location in the list would filter out the other locations, leaving only the location they selectied.

Hello @cindy.cullen, Perfect I see what you mean, but how can I limit to just one location being selected at a time with the RefinementList?

Hey @mgaytan, if you’d like users to only be able to select one option at a time, the Menu widget, is probably your best bet. Hope this is what you’re looking for!