What's your biggest current challenge? Have your say in Community Polls along the right column.

How can I link a vendor name to a specific collection using the Habitat theme?

Solved

How can I link a vendor name to a specific collection using the Habitat theme?

Keepingleft
Excursionist
16 1 1
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?
Accepted Solution (1)
farantariq93
Pathfinder
101 17 24

This is an accepted solution.

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 %}
                        <p class="product--text {{ block.settings.text_style }}" {{ block.shopify_attributes }}>
                          <a href="{{ vendorCollection.url }}" title="{{ vendorCollection.title }}">{{- block.settings.text -}}</a>
                        </p>
                    {% else %}
                    <p class="product--text {{ block.settings.text_style }}" {{ block.shopify_attributes }}>
                      {{- block.settings.text -}}
                    </p>
                    {% endif %}
If helpful then please Like and Accept Solution. Looking for bug fixing, website speed optimization or store maintenance , Hire me. Feel free to contact me in private message or on farantariq93@gmail.com.

View solution in original post

Replies 21 (21)

farantariq93
Pathfinder
101 17 24

Hi. Can you please share your store url?

If helpful then please Like and Accept Solution. Looking for bug fixing, website speed optimization or store maintenance , Hire me. Feel free to contact me in private message or on farantariq93@gmail.com.
Keepingleft
Excursionist
16 1 1

farantariq93
Pathfinder
101 17 24

You want to link vendor to the vendor page or what?

If helpful then please Like and Accept Solution. Looking for bug fixing, website speed optimization or store maintenance , Hire me. Feel free to contact me in private message or on farantariq93@gmail.com.
Keepingleft
Excursionist
16 1 1

i want it to link to a collection.  different for each item

farantariq93
Pathfinder
101 17 24

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?

If helpful then please Like and Accept Solution. Looking for bug fixing, website speed optimization or store maintenance , Hire me. Feel free to contact me in private message or on farantariq93@gmail.com.
Keepingleft
Excursionist
16 1 1

are you able to paste the code in here

farantariq93
Pathfinder
101 17 24

The code varies with the theme. Let's give it a try.

1. Go to Online Store > Themes > Edit Code

2. Find product.liquid

3. Find <p>Vendor: {{ product.vendor }}</p>

4. 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 %}
    <p><a href="{{ vendorCollection.url }}">{{ product.vendor }}</a></p>
{% else %}
<p>Vendor: {{ product.vendor }}</p>
{% 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.

If helpful then please Like and Accept Solution. Looking for bug fixing, website speed optimization or store maintenance , Hire me. Feel free to contact me in private message or on farantariq93@gmail.com.
Keepingleft
Excursionist
16 1 1

hi, i cannot find product.liquid or <p>Vendor: {{ product.vendor }}</p>

farantariq93
Pathfinder
101 17 24

As I told before, it requires some technical knowledge. Not easy for some one to make changes without technical knowledge.

If helpful then please Like and Accept Solution. Looking for bug fixing, website speed optimization or store maintenance , Hire me. Feel free to contact me in private message or on farantariq93@gmail.com.
Keepingleft
Excursionist
16 1 1

and where would i find someone to do it for me?

farantariq93
Pathfinder
101 17 24

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.

If helpful then please Like and Accept Solution. Looking for bug fixing, website speed optimization or store maintenance , Hire me. Feel free to contact me in private message or on farantariq93@gmail.com.
Keepingleft
Excursionist
16 1 1

sent

farantariq93
Pathfinder
101 17 24

Thanks, I now have access.

If helpful then please Like and Accept Solution. Looking for bug fixing, website speed optimization or store maintenance , Hire me. Feel free to contact me in private message or on farantariq93@gmail.com.
farantariq93
Pathfinder
101 17 24

This is an accepted solution.

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 %}
                        <p class="product--text {{ block.settings.text_style }}" {{ block.shopify_attributes }}>
                          <a href="{{ vendorCollection.url }}" title="{{ vendorCollection.title }}">{{- block.settings.text -}}</a>
                        </p>
                    {% else %}
                    <p class="product--text {{ block.settings.text_style }}" {{ block.shopify_attributes }}>
                      {{- block.settings.text -}}
                    </p>
                    {% endif %}
If helpful then please Like and Accept Solution. Looking for bug fixing, website speed optimization or store maintenance , Hire me. Feel free to contact me in private message or on farantariq93@gmail.com.
Keepingleft
Excursionist
16 1 1

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?

farantariq93
Pathfinder
101 17 24

Aren't they already linked to vendor page?

If helpful then please Like and Accept Solution. Looking for bug fixing, website speed optimization or store maintenance , Hire me. Feel free to contact me in private message or on farantariq93@gmail.com.
Keepingleft
Excursionist
16 1 1

Hi, yes they are but i want them to be linked to the collection with the same name instead

farantariq93
Pathfinder
101 17 24

Sorry, I have tried it. They are linked with frontpage collections and hence we can't get url of other collections.

If helpful then please Like and Accept Solution. Looking for bug fixing, website speed optimization or store maintenance , Hire me. Feel free to contact me in private message or on farantariq93@gmail.com.
Keepingleft
Excursionist
16 1 1

okay no worries, thankyou for the first part!

farantariq93
Pathfinder
101 17 24

You're welcome.

If helpful then please Like and Accept Solution. Looking for bug fixing, website speed optimization or store maintenance , Hire me. Feel free to contact me in private message or on farantariq93@gmail.com.
VickyBrabeck
Visitor
1 0 0

Hey there, I have a similar problem.

I want my vendor button on the collection and product page linked to my different vendor collection, I created. I use the Molla Theme. Can someone help me out with this, too? 

 

THEME: https://kitisummus.gitbook.io/molla/