How to change code on Dawn theme to make default product picture not first variant

How to change code on Dawn theme to make default product picture not first variant

Revelty
Visitor
1 0 0

Hey All, 

 

I am using  dawn 2.0 and I am having an issue with the default product picture. For all products the default picture is always the first variant instead of the actual picture we want to be displayed. I have read that this something that can be changed by modifying the code, but I can not seem to figure out how to modify the code to make this work. Could someone please give some advice on how to do this!

 

 

Replies 10 (10)

AvadaCommerce
Shopify Partner
3879 839 981

Hi @Revelty 

 

Since each theme has its own different element, the theme provider is best equipped with the knowledge of how to customize it. I suggest you to contact your theme provider for the solution. 

 

Shopify is DAWN theme provider. You can directly chat with a Shopify agent here.

 

If you feel like my answer is helpful, please mark it as SOLUTION. Let me know if you need more help!

banned

bgnvainterior
Visitor
2 0 0

Did you ever figure out how to do this? Searching for a solution to this same problem

MRamzan
Shopify Partner
213 3 31

You can try below solution:

 

1. Go to theme -> Edit code -> Snippets

2. Open product-media-gallery.liquid

3. Find below line of code:

 

 

{%- assign featured_media = product.selected_or_first_available_variant.featured_media -%}

 

Replace it with:

 

{%- assign featured_media = product.featured_media -%}

 

 

 

And then find below line:

 

{%- unless media.id == product.selected_or_first_available_variant.featured_media.id -%}

 

Replace it with:

 

{%- unless media.id == product.featured_media.id -%}

 

Hope this works for you.

Hire Me:

WhatsApp: +91-9145985880
Email: mohdramzaan112@gmail.com
Skype: mohdramzaan112
Littlegarden
Visitor
2 0 0

this works wonderfully, thank you very much!

Andrew_Wildman
Tourist
9 0 1

That's working for me, but now the featured image is duplicated in the variant selector. Check out this screenshot. Any idea on how to resolve this?

Duplicate Featured Image.png

 

CyndeeCee
Visitor
1 0 0

Did you get a resolution? I am having the same issue.

 

RyxMedia
Tourist
13 0 2

I got the exact same issue and couldn't find another solution.

 

This "fix" makes it worse if you ask me.

Andrew_Wildman
Tourist
9 0 1

No solution yet. I've just reorganized my images such that the first variant image is my first image... It'll do for now

RyxMedia
Tourist
13 0 2

Yeah, I did the same by calling the API and do exactly that for me for all products.

 

It is beyond me, that this is not a standard option in one of the most used themes and so many people calling for it.

JRoberts2071
Visitor
1 0 1

I'm not a coder but, looking at the code listed above...I think the highlighted code in the pic here is what needs changed.
I'm not sure what it would need changed "to" though.  I'm guessing.  
I'm having the same irritating issue!

Capture1_shopify.PNG

A "featured image" button in each product page would easily solve the issue. 
Select the image you want...hit the button.  Ugh.