Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aaliyan111/4e8e6198404c85e95caa1aada972859a to your computer and use it in GitHub Desktop.
Save aaliyan111/4e8e6198404c85e95caa1aada972859a to your computer and use it in GitHub Desktop.
Shopify Display Multiple Variant Drop-down on Collection Page
<form action="/cart/add" method="post" style="text-align:center;">
<select name="id">
{% for variant in product.variants %}
{% if variant.available %}
<option value="{{ variant.id }}">{{ variant.title }} - {{ variant.price | money }}</option>
{% else %}
<option disabled="disabled">{{ variant.title }} - Sold Out</option>
{% endif %}
{% endfor %}
</select>
<input type="submit" value="Buy now" />
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment