Product Variant Picker (Default Selection)

Hi there

Maybe someone can help us. If we filter our collection page based on the waist of a jeans it shows some products as sold out. But the waist isn’t sold out for all sizes. It’s just sold out for the first variant of the second variant option. In the video you can see the error. Is there a way that Shopify skips the sold out Variant and only shows the next possible available size?

Thank you very much!

Michael

You can do it by modifying the code for the product grid display. Simply look for the available variant and then render it.

{% assign notSoldOutVariant = product.first_or_selected_variant %}

{% unless notSoldOutVariant.available %}

{% for variant in product.variants %}

{% if variant.available %}

{% assign notSoldOutVariant = product.first_or_selected_variant %}

{% endif %}

{% endfor %}

{% endunless %}

If it is too complicated. You can try this filter app https://apps.shopify.com/ultimate-search-and-filter-1