Hello below I got the code for making swatches on my collection page but there is a problem that this uses the colors, takes the name and makes that the color instead of using the variant metafield color swatches like my product page does. Collection page url: Jewelry – InteriorGlows
It should make the swatches like on the product page, url: Astre Shine Ring – InteriorGlows
{% assign color_option_index = nil %}
{% for option in card_product.options_with_values %}
{% assign option_name = option.name | downcase %}
{% if option_name == 'color' or option_name == 'kleur' %}
{% assign color_option_index = forloop.index0 %}
{% endif %}
{% endfor %}
{% if color_option_index != nil %}
{% assign shown_colors = '' %}
{% for variant in card_product.variants %}
{% assign color = variant.options[color_option_index] | downcase %}
{% unless shown_colors contains color %}
{% assign shown_colors = shown_colors | append: color | append: ',' %}
{% endunless %}
{% endfor %}
{% endif %}
