How to add color swatch to featured collection in shopify dawn 2.0

Topic summary

A user seeks help adding color swatches to collection pages in Shopify’s Dawn 2.0 theme, similar to Aloyoga’s implementation (reference images provided).

Initial Solutions Offered:

  • One suggestion recommends using the free “King Product Options” app for color/image swatches
  • A detailed code-based solution is provided involving modifications to card-product.liquid and base.css files, utilizing variant metafields for color/image swatches

Follow-up Issues & Questions:

  • Border styling: White swatches blend with white backgrounds; users request outline/border solutions
  • Color recognition: Swatches don’t work with custom color names (e.g., “rose gold”) that aren’t standard CSS values
  • Hover tooltips: Request to display color names on hover
  • Image switching: Question about changing product images when swatches are selected on collection grids
  • Implementation problems: Multiple users report the solution not working in Craft theme or newer Dawn versions (15.2), with swatches appearing all white
  • Metafield level mismatch: One user implemented color swatches at product level rather than variant level, requiring code adaptation

Status: Discussion remains open with ongoing troubleshooting. The original responder requests store URLs to diagnose specific implementation issues.

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

Hello! Please help. Added reference as well of the one we are trying to achieve. (aloyoga)

Hope you can help! @GemPages @Sheesh_b @BSS-Commerce @KetanKumar @suyash1

1 Like

Hi @Puy

This is a custom coding level question. Although you can use this https://apps.shopify.com/king-product-options app to add color or image swatch in your store and good news is, this app is free of cost and gives you 20+ options to select from.

Thanks

1 Like

@Puy

oh sorry for that issue yes you have easy to manage this just bellow

Note: This also works for the Craft, Crave, Sense and Studio Theme.

Note: Older versions of the Dawn theme uses the Product-Card.liquid instead of Card-Product.liquid snippet file, and the assigned value for the product is 'product_card_product' not 'card_product. You will need to make the changes in the below code for the old versions of the Dawn theme.

Click here to view our example store

If you’ve been following my previous tutorials, you’re probably also watching to understand how to create color swatches on your collection page as well! Look no further, the below easy quick guide will add the functionality you need to your collection page.

You will need to have completed the color swatch tutorial for the product page, as it will include a section on how to add color metafields which we will need for the collection page.

Change Card-Product.Liquid

Changing this code which add the element to all product cards which use this code. This also includes the ‘You May Also Like’ section, and other sections aswell. Go to edit code, head over to the Snippet folder and find card-product.liquid. Once found, scroll down until you find the below code

{% render 'price', product: card_product, price_class: '' %}

Right under the above code, paste the below

{% assign keys = "Color,color,Colour,colour" | split: ',' %}
            {% for key in keys %}
            {% if card_product.options contains key %}
            
              {% for color_option in card_product.options_by_name[key].values %}
              {% for variant in card_product.variants  %}
              {% if variant.options contains color_option %}
              {% if variant.image %}
              {% assign background_style = color_option %}
              {% endif %}
              {% if variant.metafields.color.swatch %}
              {% assign background_style = variant.metafields.color.swatch %}
              {% endif %}
              {% if variant.metafields.image.swatch %}
              {% assign background_style = "url(" | append: variant.metafields.image.swatch | append: ")" %}
              {% endif %}
              {% endif %}
              {% endfor %}
			  
              
              {% endfor %}
            

            {% endif %}
            {% endfor %}

Add Code To Base.css
Now, head over to the Asset folder, find base.css and paste the below code at the bottom of the file

input[type=radio][name$=_card_color]{
                width: 20px;
                height: 20px;
                border-radius: 50%;
                appearance: none;
                background-size: 9px 9px;
                background-image: repeating-linear-gradient(45deg, #000 0, #000 1px, #ebebeb 0, #ebebeb 50%);
              }

You’re now done! you now have an awesome collection variant color swatch on your Dawn theme.

3 Likes

THANK YOU YOU HAVE BEEN MOST HELPFUL!

May i also ask how to put an outline on the round color as the white is blending with the background haha please see ‘encore set’ attached photo for reference

@KetanKumar do we have an additional code for the background of the colors so the white don’t blend in with the background?

1 Like

@Puy

yes, please share store url so i will check and let you know

oh yes, here gavalesportswear.com @KetanKumar i temporarily changed background so the whites will be seen but would like to go back to white, thanks

Hi @KetanKumar that worked like a charm, but few things:

  1. Its taking colour based on what value we put in color field, if we put rose gold, it wont take, how to make it take from the Variant metafield definitions?

  2. When it shows swatches in collection, how to enable name of colour when one hovers over it?

1 Like

@Puy

oh sorry for any issue can you please send store url so i will check and let you know

https://gloshio.com/

https://gloshio.com/collections/rings

1 Like

@Gloshio

can you please share your video what do you want

1 Like

Thanks for prompt response @KetanKumar .

Attached screenshot from others website. Need to accomplish this.

Please help me in this issue.

How to change product images in collection grid after put this code. Can we manage it by JS ? . if yes then how can i applied this variant swatches code for changing images, price on change of swatches selection

Hi

I tried your solution in Craft, but for some reason I image swatches aren’t working on the collection page.

https://house-of-cinnamon.co.za/collections/ballet-flats-collection?page=2

for this product

https://house-of-cinnamon.co.za/products/ballet-flat-with-toe-cap

What have I done wrong?

1 Like

@SDBdigital make sure color variant same image name may be try

https://www.youtube.com/watch?v=qXDTcyeOmCk

hi, my variants are showing on collection however they’re all white. How do I change them to their appropriate color?

Hello, this is not working on y dawn 15.2. It also seems that your original link is not working. Any tips? Thanks!

1 Like

@Peppino2

Sorry you are facing this issue,
It would be my pleasure to help you.
Please share your site URL,
I will check out the issue and provide you with a solution here.

@KetanKumar , hello. Thank you for sharing the tutorial. I’m having some issues implementing this solution, but I think I know why. I implemented color swatches using metafields on the product level, not on the variant level. What changes do I need to make in the code to adapt it to my environment? My store ishttps://olavisao.myshopify.com

Thank you in advance

1 Like

@alexandrepm oh sorry for that issue yes it can be done some customization code