How To Create Collection Of Variants in Shopify

Please follow video guide.

Liquid template

{% if product.has_only_default_variant %}
   <!-- render product -->
   
{% else %}
   <!-- has variant -->
  {% assign matchVariant = false %}
  {% assign metafieldKey = 'Blue' | strip | downcase %}
  {% for variant in product.variants %}
      {% liquid
        assign variantKey = variant.title | strip | remove: ' ' | downcase
        if variantKey contains metafieldKey
          assign matchVariant = true
        endif
      %}
    {% if matchVariant %}
      <a href="{{ variant.url }}">{{ variant.title }}</a>
      {% break %}
    {% endif %}     
      
  {% endfor %} <!-- end variant loop -->
{% endif %}