Skip collection page & display product page directly if only one product in that collection

taiwanspl
New Member
1 0 0

Hello guys,

I have featured collection available on my home page throught theme setting and I would like to feature a specific product unstead.

I have created a collection with only that product in it and now I would like visitors to automaticaly skip collection page and be redirected to the propuct direct as theres is only one product in the collection.

Does anyone knows a workaround / plug in I can use to get that result ?

Thanks, in advance,

Mike

0 Likes
Jason
Shopify Expert
10360 158 2009

Hey Mike,

The forum members will need more info here before help can be offered. Consider posting things like:

  • A link to your store / A link to the page that relates to your post
  • Name of the theme in use
  • Screen captures that help identify the section you're talking about

You can check how many products are in a collection so in theory it will be possible to change the link from a collection directly to the single product. 

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.

Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.


★ http://freakdesign.com.au ★
0 Likes
Tomrees165
New Member
9 0 0

I am having the same issue as taiwanspl. I have 3 featured collections on my homepage, below the slider. And each collection contains only 1 product; I would like to change that link to go directly to the product.url and not the collection.url

  • My store can be viewed at veganlifeclothing.com
  • I am using the theme: Brooklyn
  • Below is a screenshot of the 3 featured collections

The code responsible for this is located within: collection-grid-item.liquid     and is as follows:

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

I have played around with it for a while and cannot get it to link to the products url within that collection. And yes, I have read through shopify's liquid reference tutorial on objects (https://help.shopify.com/themes/liquid/objects)

 

 

0 Likes
EnikoFejer
New Member
1 0 0

I've done a little "hack" in the sections/collection-template.liquid

When it was 

  {%- if section.settings.collection_products_grid == 'collage' -%}

I've insterted/changed to this:

  {%- if collection.products.size == 1 -%}
  	{%- for product in collection.products -%}
  		<script>
          window.location.href = '{{ product.url | within: collection }}';
  		</script>
  	{%- endfor -%}
  {%- elsif section.settings.collection_products_grid == 'collage' -%}

 

Probably isn't the nicest way to do it but works like a charm.

0 Likes
Peter1983
Tourist
10 0 0

It is about products organized. 
You prefer put them in different collections and showing in one single page. That is crossing collections.

Maybe you could consider pull each single product with liquid way manually: 

{% assign product = all_products["kahrs-oak-nouveau-charcoal"] %}

 
Or try to use an APP would makes it easier.

https://apps.shopify.com/fast-collection-1 

0 Likes