Getting rid of single variant display

Highlighted
New Member
2 0 0

Hey there. We are having an issue with single variants on all of our products and not displaying them. What we want: Hide the drop down and the Option-Name for Variants without hiding the input form for product quantity.

So far we managed to get to the point where we are hiding every form of displayed content related to variants in product-template.liquid by using:

<div class="selector-wrapper js product-form__item">
  <label {% if option.name == 'default' %}class="label--hidden" {% endif %}for="SingleOptionSelector-{{ forloop.index0 }}" {% if option.values.size == 1%} style="display: none;"{% endif %}>
    {{ option.name }}
  </label>
  <select class="single-option-selector single-option-selector-{{ section.id }} product-form__input" id="SingleOptionSelector-{{ forloop.index0 }}" data-index="option{{ forloop.index }}" {% if option.values.size == 1%} style="display: none;"{% endif %}>
    {% for value in option.values %}
       <option value="{{ value | escape }}"{% if option.selected_value == value %} selected="selected"{% endif %}>{{ value }}</option>
    {% endfor %}
  </select>
</div>

The results looks like this:
Example Product Variants 1.jpg
As you can see there is no form that allows to user to put in desired product quantity. We still want the part that is marked in green and get rid of the part marked in red on this screenshot:


Example Product Variants 2.jpg
What would the correct code to achieve that look like?

Thank you for your time!

0 Likes
New Member
2 0 0

It is actually working like that. You can just enable the quantity form again without coding! Solved.

0 Likes