Add "Available In "X" More Colours" On Collection Page - Dawn 2.0

SVGRIF
Tourist
8 1 0

Hi ,

Im looking to add text that generates a number based on the amount of colours available of that product.

So if there is a red green blue option, the collection grid page will show the primary red product, but it will also have below - available in 3 colours.

So far I have tried within product-card.liquid the below code but I keep getting 0 - it isn't processing the logic below the assign num=0

 

 

{% assign num = 0 %} 
{% for option in product.options_with_values %} 
      {% if product.options_with_values == 'Colour' %}
            {% for value in option.values %}
                  {% assign num = num | plus: 1 %}
            {% endfor %}
      {% endif %}
{% endfor %} 
<p>There are {{ num }} more colours to choose </p>

 

Replies 0 (0)