Shopify themes, liquid, logos, and UX
Hey guys,
I need help regarding the variant selector. Right now it automatically selects the first variant, while I want it to be the cheapest one.
Thats the code of the variant wrapper.
<div class="variant-wrapper variant-wrapper--{{ settings.variant_type }} js">
<label class="variant__label{% if option.name == 'Default' or option.name == 'Title' %} hidden-label{% endif %}{% unless settings.variant_labels_enable %} hidden-label{% endunless %}"
for="SingleOptionSelector-{{ section_id }}-option-{{ forloop.index0 }}">
{{ option.name }}
</label>
<div class="variant-input-wrap" data-index="option{{ forloop.index }}" data-handle="{{ option.name | handleize }}">
<select
class="variant__input-{{ section_id }}"
id="SingleOptionSelector-{{ section_id }}-option-{{ forloop.index0 }}"
data-index="option{{ forloop.index }}">
{%- for value in option.values -%}
{%- assign variant_label_state = true -%}
{% if product.options.size == 1 %}
{% unless product.variants[forloop.index0].available %}
{%- assign variant_label_state = false -%}
{% endunless %}
{% endif %}
<option
value="{{ value | escape }}"
{% if option.selected_value == value %} selected="selected"{% endif %}
{% unless variant_label_state %} disabled="disabled"{% endunless %}
name="{{ option.name }}"
class="variant-input"
data-index="option{{ forloop.index }}">
{{ value }}
</option>
{%- endfor -%}
</select>
</div>
</div>
Any help is greatly appreciated!
Store: shipped.de
password: veirao
User | RANK |
---|---|
129 | |
92 | |
77 | |
70 | |
41 |
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022