I am using the habitat theme and I want to link where it shows the Vendor name on an item page to a certain collection (depending on the item). Do you know how to do this?
Hi. Can you please share your store url?
You want to link vendor to the vendor page or what?
i want it to link to a collection. different for each item
It is doable. Product page needed to be customized. Can you please share store credentials in the inbox so that I can fix the problem?
are you able to paste the code in here
The code varies with the theme. Let’s give it a try.
-
Go to Online Store > Themes > Edit Code
-
Find product.liquid
-
Find
Vendor: {{ product.vendor }}
-
Replace above code with the below one
{% assign vendorCollection = nil %}
{% for collection in collections.all %}
{% if collection.title == product.vendor %}
{% assign vendorCollection = collection %}
{% break %}
{% endif %}
{% endfor %}
{% if vendorCollection %}
{{ product.vendor }}
{% else %}
Vendor: {{ product.vendor }}
{% endif %}
Please note that the above code assumes that each vendor’s name corresponds to a collection with the same title. If you have a different setup, you’ll need to adapt the code accordingly.
hi, i cannot find product.liquid or
Vendor: {{ product.vendor }}
As I told before, it requires some technical knowledge. Not easy for some one to make changes without technical knowledge.
and where would i find someone to do it for me?
I may help you if you provide me access to the store. Go to settings > Users and Permissions and add me as a staff. My mail is in the footer of this message.
sent
Thanks, I now have access.
I have fixed the problem. Please mark this answer as accepted if it is working as desired.
{% assign vendorCollection = nil %}
{% for collection in product.collections %}
{% if collection.title == block.settings.text %}
{% assign vendorCollection = collection %}
{% break %}
{% endif %}
{% endfor %}
{% if vendorCollection %}
{{- block.settings.text -}}
{% else %}
{{- block.settings.text -}}
{% endif %}
hi, that works yes thankyou very much! would you possbly be able to link it to the vendor button for items on the home screen too?
Aren’t they already linked to vendor page?
Hi, yes they are but i want them to be linked to the collection with the same name instead
Sorry, I have tried it. They are linked with frontpage collections and hence we can’t get url of other collections.
okay no worries, thankyou for the first part!