Want a different Featured photo on product page than on collection page

Katie_Lamb
Tourist
5 0 2

I am wanting to have a different feature photo on a product page from the collection page. For example:  On one of my collection pages, I want all of the product featured photos to be a detail photo of the product. Once the item is clicked on and taken to the product page, I want the first image they see to be a different image of the ones I uploaded. (A full view of the product).  I am using the minimal template.

Is this possible to do? Thank you in advance! :)

gina-gregory
Shopify Expert
647 37 140

In the product.liquid template,

replace this line:

{% assign featured_image = product.selected_or_first_available_variant.featured_image | default: product.featured_image %}

with this:

{% assign featured_image = product.images[1] | default: product.featured_image %}

This will grab the second uploaded image (the one right after the featured image) to show as the main image on the product page.

0 Likes
christian95
Excursionist
19 0 3

I can not find the code in debut theme. Do you know how to do it? 

0 Likes
Travis_Southwor
Tourist
9 0 4

I was able to get it to work in the Debut theme by editing the product-template.liquid

 

replace

 

{%- assign featured_media = product.selected_or_first_available_variant.featured_media | default: product.featured_media -%}

 

with

 

 {% assign featured_media = product.images[1] | default: product.featured_image %}
0 Likes
cwaters
New Member
2 0 0

I tried this and it worked, but now when you get to a product page it says sold out until you switch product variant.  Any idea how to fix this? 

0 Likes
cwaters
New Member
2 0 0

This now makes it say "sold out" on the first variant. Any idea how to fix this?

 

0 Likes