A Shopify store owner using Dawn theme 15.3.0 successfully implemented color swatch functionality to change the main product image, but needs all product images to update when selecting a color variant—currently, images from all color variants remain visible simultaneously.
Proposed Solutions:
Assign variant-specific images in Shopify admin and use alt text tags (e.g., “Green”, “Black”) to differentiate images by color
Modify theme files (main-product.liquid, product-gallery.liquid) to filter media based on selected variant
Implement JavaScript to listen for variant changes and show/hide images matching the selected color using data attributes
Current Status:
The original poster has updated image alt text as recommended but remains uncertain about which specific code changes to make and in which files. Multiple respondents offered direct assistance, and a YouTube tutorial link was shared that reportedly demonstrates this exact functionality. The discussion remains open with the store owner seeking hands-on guidance to complete the implementation.
Summarized with AI on October 29.
AI used: claude-sonnet-4-5-20250929.
When I use the color switch, it only switches the main image. I need it to switch all images. So if I select the green color swatch I only want to see the green product. Currently all the other colors are also visible. I’ve managed to change only the main picture but I need all pictures to change.
If you’d like to display only the selected variant images then a lot of code changes will be required in your theme files, most likely in main-product.liquid and product-gallery.liquid.
If you’re not familiar with coding then I would highly recommend you to hire a Shopify developer in this case who can help out with this one. If you’d like to me to help then feel free to connect with me and I would be more than happy to give you a helping hand.
Great job getting the main product image to switch based on the selected color variant — that’s a solid first step! The issue you’re describing, where you’d like all the product images to update to show only the images related to the selected color (e.g., show only green product images when the green swatch is clicked), requires a bit more customization beyond what’s shown in the YouTube tutorial.
Here’s a clear solution you can implement:
Assign images to each variant
In Shopify admin, for each variant (color), upload specific images related to that color. Shopify allows you to assign variant images directly in the product setup.
Update the main-product.liquid (or main-product.liquid section) In your Dawn theme (15.3.0), open:
Enable Media Filtering by Variant Shopify has built-in functionality for this, but it’s disabled by default. Look for this block in your main-product.liquid or product.liquid file:
media_group_by = 'variant'
If it doesn’t exist, you’ll want to modify the media-gallery component to filter by variant. You can pass a data-group or data-media-id attribute and add a filter in JavaScript.
Add JavaScript to Filter Media:
You’ll need to write JavaScript that listens to the variant change and shows only media items where data-color matches the selected color. Here’s a basic example:
If you’d prefer hands-on help or a fully tailored implementation, I’d be happy to jump in and handle this for you. Let me know — I specialize in custom Shopify theme development and image filtering like this is a common enhancement.
Hello Rajweb, thank you for your quick and clear reply.
I can’t seem to solve the problem even with your explanations. I can’t seem to be able to upload multiple images for the variant. After that I am alsom
Thanks for getting back to me — no problem at all, this can be a bit tricky to set up at first.
Here’s how we can move forward:
Variant Images:
Shopify only allows one image per variant by default, but we can work around that. Upload all images for each color (e.g., green front, back, close-up), then update the Alt Text of each image to include the color name like “Green” or “Black”. This will help with filtering them later using code.
Theme Code Setup: If the code is hard to find or edit, feel free to reach out
I can guide you through the steps or request collaborator access if you’d prefer the setup to be done for you.
I’ve changed all the alt text of the images, i’ve found the theme code files but i am unsure what code to change and in which file, could you please assist me with this?