Hello @vhboy To add image swatches for color variants in the Dawn theme on Shopify (without using apps), you’ll need to customize the main-product.liquid, product-variant-picker.liquid, and global.js files. I’ll walk you through the full process to achieve this cleanly.
What You’ll Achieve:
. Replace the default color variant dropdown or pills with clickable image swatches.
. Keep it lightweight, without apps.
. Show selected state clearly.
Prerequisites:
. You’re using Dawn 9.0.0+ (let me know if your version is older).
. Your product variants have images assigned per color.
Step-by-Step Instructions:
- Assign Images to Each Variant
In your Shopify Admin:
. Go to Products > [Your Product].
. Scroll to Variants, click each one, and upload an image that represents the color.
- Edit main-product.liquid
File path: Sections/main-product.liquid
Look for this block (or similar):
{% render 'product-variant-picker', ... %}
It should already be rendering the picker, so no changes needed here unless it’s missing.
Modify product-variant-picker.liquid
File path: Snippets/product-variant-picker.liquid
Replace the contents only for the color option with image swatches.
Find this loop:
{% for option in product.options_with_values %}
And inside it, look for:
{% if option.name == 'Color' %}
If it doesn’t exist, wrap it yourself like this:
Replace or Insert this inside the loop:
{% if option.name == 'Color' %}
{% else %}
{% render 'product-variant-options', product: product, option: option, product_form_id: product_form_id %}
{% endif %}
This creates image swatches instead of default text/pills for Color.
- Add CSS for Swatches
File path: Assets/base.css or Assets/component-product.css
Scroll to the bottom and add this:
.swatch-container {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
margin: 1rem 0;
}
.swatch-label {
position: relative;
cursor: pointer;
border: 2px solid transparent;
padding: 2px;
border-radius: 4px;
}
.swatch-label input[type="radio"] {
display: none;
}
.swatch-label .swatch-image {
width: 40px;
height: 40px;
object-fit: cover;
border-radius: 4px;
border: 1px solid #ccc;
}
.swatch-label input[type="radio"]:checked + .swatch-image {
border: 2px solid #000;
}
Done! Test It Out:
-
Visit a product page with color variants.
-
Swatches should appear.
-
Selecting a swatch should change the product image and update the variant selection.
Would you like me to help add hover titles, color names under images, or support for mobile styling
plz let me know
Thank you 