Debut Theme - Variant Drop Down Menu Home Page

New Member
6 0 0

Hey guys,


Need some help I am working on some code within the product-card-grid.liquid and am having an issue with products that do not have variants with ones that do. No matter what variant I choose it will always default to the first one and I do not know how to modify the code so a variant can be selected while another one does not have one, but I know my issue which I bolded below and a picture. Any help is much appreciated! For instance, regardless of which variant I choose the flavor Vanilla will always be added to the cart....







<form method="post" action="/cart/add">
{% if product.variants.size > 1 %}
<select name="id">
{% for variant in product.variants %}
{% if variant.available %}
<option value="{{ }}">{{ variant.title }}</option>
{% else %}
<option disabled="disabled">{{ variant.title }} - Sold Out</option>
{% endif %}
{% endfor %}
{% endif %}
<input type="hidden" name="id" value="{{ }}" />
{% if product.available%}
<label for="quantity">Qty: </label>
<input min="1" type="number" id="quantity" name="quantity" value="1" />
<style>#quantity { padding:8px; width:70px; border: 1px solid #555; }</style>
<input type="submit" value="{{ 'products.product.add_to_cart' | t }}" id="add" class="btn add-to-cart" />
{% else %}
<input type="submit" value="{{ 'products.product.sold_out' | t }}" id="add" class="btn add-to-cart disabled" disabled="disabled" style="opacity: 1;">
{% endif %}