CMS Filter by number range - from/to same value issue

Hi team,

I have 2 selects acting as a from/to range filter using CMS Filter. Both selects contain the same options (1, 2, 3, up to 10). When the user selects the same option for both selects, it displays items as if only the ‘from’ was selected.

For my example, the filter in question is number of bedrooms for a property. When the user selects min 2 bedrooms and max 2 bedrooms, the filter displays properties with min 2 bedrooms (2, 3, 4, 5+ bedrooms etc) instead of only properties with specifically 2 bedrooms, no more no less.

Now for the longest time I have gotten around this by setting slightly different option values on the max select, for example 2 bedrooms would have a value of 2.2, 3 bedrooms would be 3.3 etc., but I’m now looking for a decent solution.

Quick note: Im displaying query params - when you select a min value, you’ll get ‘beds=2’, if you select a max value you’ll get ‘beds=%2C2’, if you put both min and max to 2 you’ll get ‘beds=2’ - the same as if you were only selecting a min value. If you set both selects and refresh the page, the page will reload with only the min selected. Maybe this has something to do with it.

In an ideal world, if both min and max were the same value, the url would display ‘beds=2’, because that makes the most logical sense to the user.

Funny thing is, I can’t find a single topic bringing this issue up. I would have assumed more people would have come across this.

Staging site

Read only

On the same page, have a play around with the other range filters I have, it should give you a good idea on what the issue is.

Some help here would be great! :slight_smile:

Cheers

Hey @matt5! This does make sense:

In an ideal world, if both min and max were the same value, the url would display ‘beds=2’, because that makes the most logical sense to the user.

I am not sure why this is not the native behavior but will make a note for the devs for V2.

Your current solution seems to be the easiest/least hacky solution. I understand that having the decimal point for the params is not ideal so if you want to keep the setup as is, I can write a script that cleans the URL without affecting the results while also handling the cases where a user loads the page with these params applied correctly as the value would be different on the select and the param.