Skip to content

Instantly share code, notes, and snippets.

@storefixco
storefixco / gist:c36419117a5ed2027ce8473d5abf78ee
Created September 7, 2021 15:20
Add Color Swatches to Products on Shopify - Dawn Shopify theme
<variant-radios class="no-js-hidden" data-section="{{ section.id }}" data-url="{{ product.url }}" {{ block.shopify_attributes }}>
{%- for option in product.options_with_values -%}
{% assign option_name_downcase = option.name | downcase %}
{%- if option_name_downcase contains 'color' or option_name_downcase contains 'colour' -%}
<fieldset class="js product-form__input mt-8">
<legend class="block text-xl text-dark-blue font-semibold tracking-normal leading-none">{{ option.name }}:</legend>
{%- for value in option.values -%}
<input type="radio" id="{{ section.id }}-{{ option.name }}-{{ forloop.index0 }}" class="w-24 h-24"
name="{{ option.name }}"
value="{{ value | escape }}"