Created
April 8, 2017 11:00
-
-
Save anilmeena/e6a82a8cabdf0984aebee7c068282904 to your computer and use it in GitHub Desktop.
Shopify Display Multiple Variant Drop-down on Collection Page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
I want all product variant inside a table with dropdown using js what should i do?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Thank you for sharing the code! I've added it to my collection page and now I can see the variants on each product, but unfortunately no matter which variant you select, the variant added to cart is the first available option in the product page. How do I solve this?
Thank you