How do I assign colour variant to product image for that specific colour on dawn theme 15.0 - code

Topic summary

A Shopify store owner using Dawn theme 15.0 seeks to link color variant selections to specific product images, so clicking a color (e.g., orange) displays only that color’s images.

Two Main Solutions Emerged:

  1. No-Code Method: Assign featured images to variants in product admin and enable “Pick an option” in the theme customizer. Limitation: shows only one image per variant, not multiple images for the same color.

  2. Code-Based Solution: Requires three steps:

    • Add alt text to product images matching variant color names exactly
    • Replace code in product-media-gallery.liquid file
    • Add JavaScript to main-product.js

Key Challenge: Users want all product images visible initially, but filtered to show only relevant color images when a variant is selected. The default behavior shows either all images or only single variant images.

Current Status: Mixed results reported. Some users successfully implemented the code solution, while others (particularly on Trade theme) report it’s not working. The discussion remains active with ongoing troubleshooting, particularly around displaying multiple images per color variant while maintaining proper filtering functionality.

Summarized with AI on October 29. AI used: claude-sonnet-4-5-20250929.

And if I had assigned the different variant colours to a product image in the product section, I was able to select the colour variant and it will be assigned to the correct product image, however there is a problem - all my product images for that one product is strangely not allowed to be displayed.

So it’s either one or the either. So that’s why I’m trying to find a way to code it, so that works for me.

Thanks for your input though!