filter_value.url_to_add it's not replacing the active filter
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
filter_value.url_to_add it's definitely not working as I'd expect from reading the doc:
https://shopify.dev/api/liquid/objects/filter-value#filter_value-url_to_add
When I use it's not returning me the current page URL with the filter value parameter added, it's instead returning me the current page url with an extra url parameter appended at the end. Which sounds similar, but it's all different story.
Let me explain better. Let's assume I have two sets of filters (color and size).
Colors:
<a href="/collections/sale?filter.v.option.color=black">Black</a>
<a href="/collections/sale?filter.v.option.color=red">Red</a>
<a href="/collections/sale?filter.v.option.color=blue">Blue</a>
Sizing:
<a href="/collections/sale?filter.v.option.size=M">M</a>
<a href="/collections/sale?filter.v.option.size=L">L</a>
All good so far. Let's say that I click on color Black, this is what happens:
Colors:
<a href="/collections/sale?filter.v.option.color=black">Black</a>
<a href="/collections/sale?filter.v.option.color=black&filter.v.option.color=red">Red</a>
<a href="/collections/sale?filter.v.option.color=black&filter.v.option.color=blue">Blue</a>
Sizing:
<a href="/collections/sale?filter.v.option.color=black&filter.v.option.size=M">M</a>
<a href="/collections/sale?filter.v.option.color=black&filter.v.option.size=L">L</a>
Sizing looks good to me, color nope. Now let's click on Blue, this is what happen:
Colors:
<a href="/collections/sale?filter.v.option.color=blue&filter.v.option.color=black">Black</a>
<a href="/collections/sale?filter.v.option.color=blue&filter.v.option.color=red">Red</a>
<a href="/collections/sale?filter.v.option.color=blue">Blue</a>
Sizing:
<a href="/collections/sale?filter.v.option.color=bluefilter.v.option.size=M">M</a>
<a href="/collections/sale?filter.v.option.color=bluefilter.v.option.size=L">L</a>
So if the filter is a different filter, the url looks good as expected, both sizing filters are perfect, but within the same filter is not assembling the url correctly. Bottom line I think that this is a bug. Is there a way that this can be used? Am I missing something?
Let me know if you have ideas.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the documented filter_value.url_to_add examples from the issue, especially switching between two values in the same filter and then between different filters. Compare the generated URLs with the expected replacement and preservation behavior shown in the examples; the issue is done when those URLs are assembled correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100