{% for product in products %} {% assign first_available_variant = false %} {% for variant in product.variants %} {% if !first_available_variant and variant.available %}{% assign first_available_variant = variant %}{% endif %} {% endfor %} {% unless first_available_variant %}{% assign first_available_variant = product.variants[0] %}{% endunless %} {% if product.images[0] %} {% assign featured_image = product.images[0] | img_url: '350x' %} {% else %} {% assign featured_image = no_image_url | img_url: '350x' %} {% endif %}