{% comment %} Set the extension of your color files below. Use 'png', 'jpeg', 'jpg' or 'gif'. {% endcomment %} {% assign file_extension = 'png' %} {% if swatch == blank %}

You must include the snippet swatch.liquid with the name of a product option.

Use: {% raw %}{% include 'swatch' with 'name of your product option here' %}{% endraw %}

Example: {% raw %}{% include 'swatch' with 'Color' %}{% endraw %}

{% else %} {% assign found_option = false %} {% assign is_color = false %} {% assign option_index = 0 %} {% for option in product.options %} {% if option == swatch %} {% assign found_option = true %} {% assign option_index = forloop.index0 %} {% assign downcased_option = swatch | downcase %} {% if downcased_option contains 'color' or downcased_option contains 'colour' %} {% assign is_color = true %} {% endif %} {% endif %} {% endfor %} {% unless found_option %}

You included the snippet swatch.liquid with the name of a product option — '{{ swatch }}' — that does not belong to your product.

Use {% raw %}{% include 'swatch' with 'name of your product option here' %}{% endraw %}

Example: {% raw %}{% include 'swatch' with 'Color' %}{% endraw %}

This is case-sensitive! Do not put in 'color' if your product option name is 'Color'.

{% else %}
{{ swatch }}
{% assign values = '' %} {% for variant in product.variants %} {% assign value = variant.options[option_index] %} {% unless values contains value %} {% assign values = values | join: ',' %} {% assign values = values | append: ',' | append: value %} {% assign values = values | split: ',' %}
{% if is_color %}
{{ value }}
{% endif %} {% if is_color %} {% else %} {% endif %}
{% endunless %} {% if variant.available %} {% endif %} {% endfor %}
{% endunless %} {% endif %}