elgobbo
1
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,
You can try to update the code to this and check if it works
[{{ product.collections }}](https://recallclothing.com/collections/{{ product.collections }})
elgobbo
3
Shall I remove all the IF in the code then ? I’m not even exactly sure what they do.
elgobbo
4
Please just use the code I sent
elgobbo
6
Not working apparently. See below. Do you have another idea ?
elgobbo
7
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 %}
{% if its_a_match %}
{{ product.vendor }}
{% else %}
{{ product.vendor }}
{% endif %}
{% endif %}
Please update code to this and check again
{% if product.collections.size > 0 %}
{% for collection in product.collections %}
{{ collection.title }}
{% endfor %}
{% endif %}