Skip to content

Instantly share code, notes, and snippets.

@curiouscrusher
Created June 14, 2018 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save curiouscrusher/27f9c47fc103f61e5148015d133cfb91 to your computer and use it in GitHub Desktop.
Save curiouscrusher/27f9c47fc103f61e5148015d133cfb91 to your computer and use it in GitHub Desktop.
Swap the select dropdowns for radio input types and retain full Slate compatibility
{% unless product.has_only_default_variant %}
{% for option in product.options_with_values %}
<div class="selector-wrapper js">
{%- assign i = forloop.index0 -%}
<h1>
{{ option.name }}
</h1>
{% for value in option.values %}
<input class="" id="SingleOptionSelector-{{ i }}-{{ value | handle }}" data-single-option-selector data-index="option{{ option.position }}" type="radio" name="SingleOptionSelector-{{ i }}" value="{{ value | escape }}"{% if option.selected_value == value %}checked="checked"{% endif %} {% unless current_variant.available %}disabled="disabled"{% endunless %} >
<label for="SingleOptionSelector-{{ i }}-{{ value | handle }}"><span>{{ value }}</span></label>
{% endfor %}
</div>
{% endfor %}
{% endunless %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment