1

With Shopify I am trying to alter my product template to display a dropdown select list instead of radio buttons for my product variants. I managed to do this but when you try and add a product to the cart from the list it says, "No variant ID was passed."

Here is the code for their radio buttons:

<ul id="product-variants">
            {% for variant in product.variants %}
            <li>
              {% if variant.available %}
                <input type="radio" name="id" value="{{variant.id}}" id="radio_{{variant.id}}" style="vertical-align: middle;" {%if forloop.first%} checked="checked" {%endif%} />
                <label for="radio_{{variant.id}}"><span class="sku">{{ variant.sku }}</span>  {%if variant.title != 'Default' %}{{ variant.title }} for {%endif%}  <span class="price">{{ variant.price | money_with_currency }}</span></label>
              {% else %}
                <del style="margin-left: 26px">{{ variant.title }}</del>&nbsp;<span>Sold Out!</span>
              {% endif %}
            </li>
            {% endfor %}
          </ul>

Here is the code for my dropdown select at this point:

<select id="product-variants">
            {% for variant in product.variants %}
            <li>
              {% if variant.available %}
                <option value="{{variant.id}}" selected="selected"><span class="sku">{{ variant.sku }}</span>  {%if variant.title != 'Default' %}{{ variant.title }} for {%endif%}  <span class="price">{{ variant.price | money_with_currency }}</span></option>
              {% else %}
                <del style="margin-left: 26px">{{ variant.title }}</del>&nbsp;<span>Sold Out!</span>
              {% endif %}
            </li>
            {% endfor %}
          </select>

Thanks,

Wade

1 Answer 1

1

https://help.shopify.com/themes/development/templates/product-liquid

This wiki had the answer to my question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.