Hello,
I am needing some help, I found coding online for color swatches for the DAWN Theme, they have worked perfectly but they do not display the color name when you hover and or select the color, I would love for the color name to appear next to where is says ‘Color’. I would love some help on this, attached below is how the swatches currently look & the coding I used
I would appreciate any help or advice you can give, I’ve spent countless hours over the last week trying to find a solution.
Thanks,
Natalie
Change Main-Product.Liquid
Go to edit code, head over to the Section folder and find main-product.liquid. Once found, scroll down until you find the below code:
{{ value }}
replace the above, with the below code
{% assign variant_needed = null %}
{% for variant in product.variants %}
{% if variant.options contains value %}
{% assign variant_needed = variant %}
{% endif %}
{% endfor %}
{% if variant_needed.metafields.color.swatch and option.name == “Color” %}
 
{% elsif variant_needed.metafields.image.swatch and option.name == “Color” %}
 
{% else %}
{{ value }}
{% endif %}
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
.product-form__input input[type=“radio”] + .color-swatch {
border: 3px solid #f4f5ff; /* Change this hex code to change the color of the non-active/non-selected variant */
width: 40px;
height: 40px;
padding: 0;
}
.product-form__input input[type=“radio”]:checked + .color-swatch,
.product-form__input input[type=“radio”]:hover + .color-swatch {
border: 3px solid #ccd1d1; /* Change this hex code to change the color of the active/selected variant */
}
.product-form__input input[type=“radio”] + .swatch {
border: 3px solid #f4f5ff; /* Change this hex code to change the color of the non-active/non-selected variant */
width: 40px;
height: 40px;
padding: 0;
color: #000;
display: inline-flex;
justify-content: center;
align-items: center;
}
.product-form__input input[type=“radio”]:checked + .swatch,
.product-form__input input[type=“radio”]:hover + .swatch {
border: 3px solid #ccd1d1; /* Change this hex code to change the color of the active/selected variant */
background: none;
}





