All things Shopify and commerce
Hi,
I would like to change the URL query when someone click on the link vendor in the product page.
Currently, the link to a specific vendor in the product page links to
https://recallclothing.com/collections/vendors?q=vendor name
I would like it to link to
https://recallclothing.com/collections/vendor name
Here is the code from product.liquid which is used for this link
{% if product.vendor %} <div class="product__block__text" style="--PB: {{ block.settings.padding_bottom }}px;" {{ block.shopify_attributes }}> {% if block.settings.add_vendor_link %} <p><a href="{{ product.vendor | url_for_vendor }}" class="product__form__link">{{ product.vendor }}</a></p> {%- else -%} <p class="product__form__link">{{ product.vendor }}</p> {% endif %} </div> {% endif %}
Does anyone know how to modify it ?
Many thanks,
Solved! Go to the solution
This is an accepted solution.
Solved with:
{% if product.vendor %}
{% assign its_a_match = false %}
{%- capture my_collection_handle -%}{{ product.vendor | handleize | strip | escape }}{%- endcapture -%}
{% assign my_collection_handle_stripped = my_collection_handle | strip | escape %}
{% unless collections[my_collection_handle_stripped] == blank %}
{% assign its_a_match = true %}
{% endunless %}
<div class="product__block__text" style="--PB: 20px;" >
{% if its_a_match %}
<a href="{{ routes.collections_url }}/{{ my_collection_handle }}" class="product__form__link">{{ product.vendor }}</a>
{% else %}
<a href="{{ product.vendor | url_for_vendor }}" class="product__form__link">{{ product.vendor }}</a>
{% endif %}
</div>
{% endif %}
You can try to update the code to this and check if it works
<div class="product__block__text" style="--PB: {{ block.settings.padding_bottom }}px;" {{ block.shopify_attributes }}>
<p><a href="https://recallclothing.com/collections/{{ product.collections }}" class="product__form__link">{{ product.collections }}</a></p>
</div>
- Found this helpful? Hit "Like" and "Accept as Solution"!
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
Built for Shopify
Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...Sign up now.
Shall I remove all the IF in the code then ? I'm not even exactly sure what they do.
It doesn't seem to work. The link is now https://recallclothing.com/collections/CollectionDropCollectionDropCollectionDropCollectionDrop
- Found this helpful? Hit "Like" and "Accept as Solution"!
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
Built for Shopify
Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...Sign up now.
Not working apparently. See below. Do you have another idea ?
This is an accepted solution.
Solved with:
{% if product.vendor %}
{% assign its_a_match = false %}
{%- capture my_collection_handle -%}{{ product.vendor | handleize | strip | escape }}{%- endcapture -%}
{% assign my_collection_handle_stripped = my_collection_handle | strip | escape %}
{% unless collections[my_collection_handle_stripped] == blank %}
{% assign its_a_match = true %}
{% endunless %}
<div class="product__block__text" style="--PB: 20px;" >
{% if its_a_match %}
<a href="{{ routes.collections_url }}/{{ my_collection_handle }}" class="product__form__link">{{ product.vendor }}</a>
{% else %}
<a href="{{ product.vendor | url_for_vendor }}" class="product__form__link">{{ product.vendor }}</a>
{% endif %}
</div>
{% endif %}
Please update code to this and check again
{% if product.collections.size > 0 %}
{% for collection in product.collections %}
<div class="product__block__text" style="--PB: {{ block.settings.padding_bottom }}px;" {{ block.shopify_attributes }}>
<p><a href="{{ collection.url }}" class="product__form__link">{{ collection.title }}</a></p>
</div>
{% endfor %}
{% endif %}
- Found this helpful? Hit "Like" and "Accept as Solution"!
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image
Built for Shopify
Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- En...Sign up now.
Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025