Shopify themes, liquid, logos, and UX
Hello, like a lot of people, I am not happy with the default theme behaviour of showing a variant image instead of the product featured image before a variant has been selected. Is there a tutorial for Dawn 6.0 please to change this? Thank you.
Ok I eventually tracked down this post with a reply from Shopify – https://community.shopify.com/c/shopify-discussions/how-to-disable-auto-variant-selection/td-p/12820.... So Shopify's official position is that they know that loads of people want this functionality but they have not included it in any of their new themes and won't provide support either. So if this functionality is absolutely essential (which it is), we either have to use vintage themes, pay a developer for customisation of new Shopify themes, or pay $300 for the Empire theme. That's not good enough, this is basic functionality that loads of people want.
Always backup a theme before changing code.
If you need the below fully customized contact me via email in my sig.
@Zoe_S_Designer I haven't verified this but you may be able to modify this by changing 2 lines
https://github.com/Shopify/dawn/blob/main/sections/main-product.liquid#L86
From:
{%- if product.selected_or_first_available_variant.featured_media != null -%}
{%- assign featured_media = product.selected_or_first_available_variant.featured_media -%}
To:
{%- if product.featured_media != null -%}
{%- assign featured_media = product.featured_media -%}
This needs to check for interoperating with any javascript, and theme settings; basically thought through to understand WHY shopify chose not do this which really may just be a result of lots of stores not setting a featured image at the product level.
And that if statement should be given and else, or elsif, so it defaults to trying to use the selected or first available variants featured media when a product has no image|media featured.
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
Just follow below steps:
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 also 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.
If you have not dawn theme then you can try the same if doesn't work then let me know.
Thanks.
This duplicates the first image. How do you stop that from happening?
Yes, the code duplicates the first MEDIA image in 15.2.0. Use this instead.
This video code works better. Confirm...Thank you.
https://drive.google.com/file/d/1Dsj00ddE_ivZH4EM_yYRn66fqrQwkBq0/view?usp=share_link
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025