Getting option value from Select > Option to Cart

New Member
1 0 0

I'm trying to get the correct of the DropDown variants, dosen't matter the variant I select, always is passed the first options to cart.

<form action="/cart/add" method="post">
{%- unless product.has_only_default_variant -%} 
{%- for option in product.options_with_values -%}
<span>{{product_option.name}}</span>
    <select id="ProductSelect-{{ forloop.index0 }}" name="id" data-index="option{{ forloop.index }}">
{%- for value in option.values -%}
        <option value="{{ value | escape }}" {% if option.selected_value==v alue %} selected="selected" {% endif %}> {{ value | escape }}</option>
{% endfor %}
</select> {% endfor %} {% endunless %} <input type="hidden" id="variant-id" name="id" value="{{product.variants.first.id}}" /> <input type="submit" value="Add to Cart" class="btn btn-main"> </form>


Here is the link: https://skin-elixir-swiss.myshopify.com/products/victor

0 Likes