Multi-Word Vendors Leading to 404 Collection Pages

Hi All!

I appreciate the help anyone can provide! I’m looking to make the Vendor/Brand name from product pages clickable and lead to auto-populated collections by vendor. I’m using this code:

{% if product.vendor %}

Brand: {{ product.vendor }}

{% endif %}

The problem is, for single-word vendors, it populates just fine, but if a vendor name is more than one word, it leads to a 404 page. I’m sure it’s just a small thing I’m missing, but any ideas there? Thanks again!

Hi @MontanaGC :waving_hand: Confirm if it’s a url encoding problem, try manually replacing the space, or dashes, with the space url encoding: %20.

The vendor value is being put into a query parameter so it needs to be url encoded not handelize as that inserts dashes and the vendor name does not have spaces in it.

https://shopify.github.io/liquid/filters/url_encode/ , e.g. q={{ product.vendor | url_encode }}

If you need this debugged further or theme customization then contact me for services
Contact info in forum signature.
ALWAYS please provide context, examples: store url, theme name, post url(s) , or any further detail in ALL correspondence.

1 Like

This worked like a charm! Thanks, Paul!

1 Like