james-a of Underwaterpistol
12/1/2017 - 11:14 AM

Swatches Collection Page

<!-- Product swatches -->


      {% for option in product.options %}
      {% if option == 'Colour' %}
      {% assign index = forloop.index0 %}
      {% assign colorlist = '' %}
      {% assign color = '' %}
      {% for variant in product.variants %}
      {% capture color %}{{ variant.options[index] }}{% endcapture %}
      {% unless colorlist contains color %}

     
      <div class="swatch tip" data-tip="{{ color }}">
        <a href="{{ product.url }}/?variant={{ variant.id }}">
          <img src="{{ color | downcase | replace:' ','-' | append:'.png'| asset_url }}" width="30" height="30" />
        </a>
      </div>

     

      {% capture tempList %}
      {{colorlist | append: color }}
      {% endcapture %}
      {% assign colorlist = tempList %}
      {% endunless %}
      {% endfor %}
      {% endif %}
      {% endfor %}

       <!-- End product swatches -->