I have shopify shop and i found a code on internet to replace the color by his image like this.
I really need to add a border when the color is selected, can someone help me please.
the code is to do this is :
{%if option.name == "Couleur"%}
<label>{{option.name}}</label>
{%assign index = forloop.index %}
{%for value in option.values%}
<input class="single-option-selector-{{ section.id }}" id="Couleur-{{forloop.index}}" type="radio" style='visibility:hidden;display:none' name="Couleur" value="{{ value | escape }}" data-index="option{{index}}" {% if option.selected_value == value %}checked{%endif%}/>
<label id="colorSelected" class="label_couleur" for="Couleur-{{forloop.index}}" style="margin: 0 5px;">
<img class="img_couleur" src="{{value | escape | append:'.jpg' | strip | asset_url }}"/>
</label>
{%endfor%}
{%else%}
I really need help thanks in advance.
You can take reference in the Shopify community forum, provided a solution to create swatch images for color in products. Please click here to check to achieve.
This solution will not work venture and boundless theme. I implement in debut theme is working for client store.