When filtering products with a price filter, the min
and max
values change.
#2491
Unanswered
ujike-ryota
asked this question in
Help
Replies: 1 comment 2 replies
-
One option would be to define your collection filters and settings globally with metafields or metaobjects. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
When applying a price filter to a collection, the minimum and maximum prices that can be used for filtering within that collection change. For example, let’s say the
input
values for the price in the filters object, when no filter is applied, are returned as follows:This indicates that the collection can be filtered within the range of 0 to 10,000. Next, if you filter the products in this collection to a range of 1,000 to 5,000, the filters object would then look like this:
At first glance, this seems correct, but there is one problem. When providing a UI that allows users to set the minimum and maximum prices, such as with a slider, if the returned min and max values change, the min and max of the slider will also change. Even if the collection is filtered to 1,000 to 5,000, I would like to set the min and max of the slider to the original values of 0 and 10,000, which were available before filtering.
Due to the fact that the page is reloaded each time the query parameters change, it’s not possible to retain the original values of 0 and 10,000.
Is there a way to retrieve the original min and max values for price even after the collection has been filtered? Alternatively, if there are any best practices for this, could you please share them with me?
Beta Was this translation helpful? Give feedback.
All reactions