If you’re running a Shopify store with the Dawn theme, you can add swatches to your Collections page as well as the Related Products page. It can make the shopping experience even smoother for your clients. Your clients won't have to click into every product. Instead, they can see colours or style options right on the product card. Here's how you set it up:
Steps to Add Swatches
Open the Theme Code Editor
-
Visit the Shopify Admin console.
-
Click on Online Store and navigate to Themes.
-
Click on the Edit Code option
Create a Swatch Snippet
-
Open the Snippets folder.
-
Click on the “Add a new snippet” option.
-
Change the name to :

-
To do this, right-click on the Snippet folder and select the “Create Snippet file name” option.
-
Paste the following code inside the text box:
This will help you create a Swatch Snippet.
Add JavaScript
-
Open the Assets folder.
-
Click on the “Add a new asset file” option. Name the file:

-
Open the new file and paste the following code inside the text box:
Include the JavaScript in Theme
-
Open the Layout folder and then open the theme.liquid option.
-
Add this line before the closing </body> tag:

Define Swatch Options
-
Again open the Snippets folder and then open the card-product.liquid file.
-
Add the following line at the top of the file:
Wrap Product Card
-
While you have the card-product.liquid file open, locate the following lines:
-
Wrap it with the following DIV:

Render the Swatches
-
Before you close the </div> of the product card, insert the following rendering code that calls your snippet and displays swatches:
Save and Test
-
Open the Collections page. Or, you can also open a product page with related products.

-
You should now see clickable swatches under each card. Select one and it will update the product image instantly.

Conclusion
These before mentioned steps will help you add color swatches to your Shopify store on the Dawn theme. This will ensure that your shoppers are able to browse colors and variants directly on collection pages and related products. It makes the shopping experience faster and more soothable. This is a small change, but you can considerably improve your engagement and sales through this step.