Color Swatch Repair

Shopify Partner
3 0 2

I setup color swatches for my shirts and then ran into problems with my prints which also have multiple variants. This is the error it spit out.

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

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

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

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

If anyone else runs into the same problem, you can fix it with a tiny code modification in product.liquid to make sure you're not calling for the color swatches when you don't need them.

{% for option in product.options %}
     {% if product.available and product.variants.size > 1 and option == 'Color' %}
          {% include 'swatch' with 'Color' %}
     {% endif %}
{% endfor %}

I'm not sure how to contact the person who made the tutorial but I hope it gets updated.

1 Like
New Member
1 0 0

Thank you!!! Was struggling with this for so long and this WORKS! Shopify needs to update their documentation....Its 5 years later since this post...and they still haven't updated this swatch tutorial: