Skip to content

Instantly share code, notes, and snippets.

View curiouscrusher's full-sized avatar
🛠️

Nate Holland curiouscrusher

🛠️
View GitHub Profile
@curiouscrusher
curiouscrusher / radio-options.liquid
Created June 14, 2018 18:56
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>