Link collection lists to a custom page

Highlighted
New Member
3 0 1

I would like to link each of my collections to a custom page that I have built. How would I do this?

Theme: Debut

 

Go to collections: https://www.cottontailbowco.com/collections

When the user clicks on Basic Collection, redirect the user to: https://www.cottontailbowco.com/pages/basic-styles

When the user clicks on Easter Collection, redirect the user to: https://www.cottontailbowco.com/pages/easter-styles

When the user clicks on Personalized Collection, redirect the user to: https://www.cottontailbowco.com/pages/personalized-styles

 

Any help would be greatly appreciated!

Highlighted
Shopify Expert
2684 67 846

Hi Deana,

you can modify your collection-grid-item.liquid Snippet. Before making any edits, create a backup copy of the theme by clicking Actions->Duplicate.

Find this code 

  <a href="{% if collection.products == empty %}#{% else %}{{ collection.url }}{% endif %}" class="collection-grid-item__link">

and replace it with 

{% assign page_handle = collection.handle | remove: "-collection" | append: "-styles" %}
{% if pages[page_handle].url != "" %}
  {% assign url = pages[page_handle].url %}
{% elsif collection.products == empty %}
  {% assign url = "#" %}
{% else %}
  {% assign url =  collection.url %}
{% endif %}

<a href="{{ url }}" class="collection-grid-item__link">

For each collection on your /collections page the code takes the collection handle, removes the "-collection" part and appends "-style". This way from basic-collection  we get basic-styles. Then the code looks for Page with this handle and uses its URL, otherwise it uses the URL ot the collection.

So you need to keep the nameing convention and the code will do what you want.

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
I am away till Feb-15.
Highlighted
New Member
3 0 1

Hi Tim,

This is EXACTLY what I needed/was looking for. It worked perfectly (and just before we launched our new collection).

Thank you so much for the reply. Cheers!

0 Likes
Highlighted
Tourist
14 0 1

 

 

Hi, thank you for a really good answer. I use the Supply theme and the instructions do not tally. Is there a tweak for Supply?

At the moment I have a 'more categries' link on my homepage which opens a page full of collections I do not want visible. If I could control the content on this page it would be massively beneficial!

0 Likes
Highlighted
New Member
1 0 1

Hi,

i have the supply theme there is no code like that in the collection-grid-item. Is there some other code that i have to replace? An answer would be very nice. 

Highlighted
New Member
2 0 6

Im having the same issue but am using pacific theme. I cannot find the code which needs to be replaced is there an alternate code for pacific theme? any help is appreciated. 

0 Likes
Highlighted
New Member
1 0 0

Can someone create one for Supply theme? Would be great if we can have one! Thanks!

0 Likes