Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save anilmeena/e6a82a8cabdf0984aebee7c068282904 to your computer and use it in GitHub Desktop.
Save anilmeena/e6a82a8cabdf0984aebee7c068282904 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>
@clarices1
Copy link

how to separate the variation title with the price like sample site
https://movementfood.com/collections/move-menu

the variation is dropdown but the price would be separate? please help

@Debsies87
Copy link

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

@meet2234
Copy link

meet2234 commented Nov 24, 2022

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