Recently I have added variants to some of my products. However, this brings up the issue that the available sizes on the product grid show up twice if there are two variants. Here is an example:
For future reference, here is the code to display available sizes under products in the product grid:
{% if collection.handle == "unique-hoodies" or collection.handle == "t-shirts" or collection.handle == "4x-collection" or collection.handle == "living-in-the-wrong-time"%}
{% for option in product.options %}
{% if option == 'Size' %}
{% assign option_index = forloop.index0 %}
{% 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: ',' %}
{{ value | escape }}
{% endunless %}
{% endfor%}
{% endif %}
{% endfor %}
{% endif %}
{% include 'product-price-listing', product: product, show_vendor: show_vendor %}
Place it at the end of product-card-grid.liquid in snippets. Of course, you will need to change the collection names to collections you want the sizes to show.