d
Topic
Posts:
1
December 04, 2013

Display only the first variant option This post is outdated

I'm trying to display the variants as radio buttons on the product page and I can't seem to only show the first option. 

For example, I only want to show Size and not Color because the colors are all the same.

Here's the code I have:

 

<div class="product-variants cf">
                    <ul class="option-blocks cf">
                      {% for variant in product.variants %}
                        <li class="{% cycle 'odds': 'odd', 'even' %}">
                          {% if variant.available %}
                            <input class="product-option" type="radio" name="id" value="{{ variant.id }}" id="radio_{{ variant.id }}" {% if forloop.first %}checked="checked"{% endif %} />
                            <label for="radio_{{ variant.id }}" class="radio">
                              {{ product.options.first }}: {{ product.variants.first.title }}
                            </label>
                          {% else %}
                            <input type="radio" name="id" value="{{ variant.id }}" id="radio_{{ variant.id }}" disabled="disabled" />
                            <label for="radio_{{ variant.id }}" class="radio disabled-radio">
                            {{ variant.title | escape }}
                          </label>
                          {% endif %}
                        </li>
                      {% endfor %}
                    </ul>
                  </div>