This fixed the first image issue. However, it created a new issue. Now when I click the variant swatches, nothing happens. Prior to this modification, clicking the variant images caused them to replace the product image. Help?!
Topic summary
Users seek to display the featured product image by default on product pages instead of the first variant image in Shopify’s Dawn theme (v8.0.0 and later versions).
Primary Solution (by made4Uo & gr_trading):
- Edit
product-media-gallery.liquidin the Snippets folder - Replace
product.selected_or_first_available_variant.featured_mediawithproduct.featured_mediaat specific lines (originally lines 67-68, 92) - gr_trading provided complete replacement code for the entire file
Common Issues Reported:
- Duplicate images: Featured image appears twice in gallery (lines 92 and 237 need modification)
- Mobile variant switching: Selected variant images don’t update properly on mobile
- Missing variant images: Default variant image disappears from gallery after implementation
- Variant selection bugs: Clicking variant swatches doesn’t change images; URL doesn’t update with variant selection
Alternative Solution:
Rizwan-Shabbir shared a comprehensive code replacement that reportedly fixes bugs present in earlier solutions, confirmed working by multiple users on Dawn and Refresh themes.
Key Recommendation:
Backup theme files before implementing changes. Line numbers vary between Dawn versions (8.0.0, 13.0.0, 15.2.0), requiring users to locate code by content rather than exact line numbers. Some users report needing custom fixes for specific theme versions or layouts.