CUSTOMIZE A LINK IN MY HOME PAGE THEME BROOKLYN

Highlighted
New Member
1 0 1

Hi,

In my theme brooklyn right under my slide show, i have 3 boxes of featured collections, 2 of them are linked the actual collection and the middle one is linked to a contact form. 

I already set up my home with all the pictures that i want and its designed how i wanted it to be so i dont want to change my layout but i would like to change the link in the 2 boxe linked to collection and link them directly to the product cuz i have only one.

I would like to remove the extra step of going on collection before reaching the product.

I know that its n easy change for someone that know a little about coding, so i am hoping that some one in the forum can help me please.

Best,

 

Mehdi

 

1 Like
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
400 0 72

Hi Mehdi,

Britton here with the Shopify support team.

In order to accomplish that you will need to replace some code inside of the collection-grid-item.liquid file in your theme. For me it was on lines 25 and 26 and looked like this: 

<div class="grid__item {{ grid_item_width }} collection-collage__item text-center">
  <a href="{{ collections[collection_handle].url }}" class="collection-grid__item-link collection-collage__item-wrapper">

Instead, replace that with the following:

<div class="grid__item {{ grid_item_width }} collection-collage__item text-center">
  {% if template == 'list-collections' %}
  	<a href="{{ collections[collection_handle].url }}" class="collection-grid__item-link collection-collage__item-wrapper">
  {% else %}
  	{% if forloop.index == 2 %}
  		<a href="/pages/about-us" class="collection-grid__item-link collection-collage__item-wrapper">
  	{% else %}
  		<a href="/products/organic-body-butter" class="collection-grid__item-link collection-collage__item-wrapper">
  	{% endif %}  
  {% endif %}  

Keep in mind that in the above collection I assumed that you wanted the middle collection image to link to your "About Us" page. If not, you will want to replace the link found in this line with the correct URL:

<a href="/pages/about-us" class="collection-grid__item-link collection-collage__item-wrapper">

I hope that helps and remember to back up your theme by duplicating it before making any code changes!

-Britton

Britton Shopify Guru
0 Likes
Highlighted
New Member
9 0 0

Hi there, I have an almost idential problem with mehdi as in I am using Brooklyn and am showing 3 collections on my homepage, however I would like to link each of them to a specific product page. I have pasted in the above code in the neccessary place, however its taking the first collection and the last collection to the same spot

0 Likes
Highlighted
New Member
2 0 0

Hey Tomrees,

 

Did you ever figure this out? I know its from a while ago but I'm struggling with this too.

 

Thanks

0 Likes