Skip to content

Instantly share code, notes, and snippets.

@MrJoshFisher
Created July 20, 2021 15:16
Show Gist options
  • Save MrJoshFisher/8386cb85fff5082bee4c0662992892bb to your computer and use it in GitHub Desktop.
Save MrJoshFisher/8386cb85fff5082bee4c0662992892bb to your computer and use it in GitHub Desktop.
[Radio Buttons Shopify Product] #shopify #liquid
{% for option in product.options_with_values %}
<label {% if option.name == 'default' %}class="label--hidden" {% endif %}for="SingleOptionSelector-{{ forloop.index0 }}">
{{ option.name }}
</label>
{% assign option_position = forloop.index %}
<fieldset class="product-options-fieldset">
{%- for value in option.values -%}
<input type="radio" class="single-option-selector-{{ section.id }} "
{% if option.selected_value == value %} checked="checked"{% endif %}
value="{{ value | escape }}"
data-index="option{{option_position}}"
name="{{ option.name | handleize }}"
id="SingleOptionSelector-{{option_position}}-{{ forloop.index0 }}">
<label for="SingleOptionSelector-{{option_position}}-{{ forloop.index0 }}">
{{value}}
</label>
{%- endfor -%}
</fieldset>
<!-- <div class="selector-wrapper js product-form__item">
<label for="SingleOptionSelector-{{ forloop.index0 }}">
{{ 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 }}"
>
{% for value in option.values %}
<option value="{{ value | escape }}"{% if option.selected_value == value %} selected="selected"{% endif %}>{{ value }}</option>
{% endfor %}
</select>
</div>
-->
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment