Skip to content

Instantly share code, notes, and snippets.

View husseyexplores's full-sized avatar
🐾
/ᐠ .ᆺ. ᐟ\ノ ( ̿–ᆺ ̿–)ノ

Hassan Usman husseyexplores

🐾
/ᐠ .ᆺ. ᐟ\ノ ( ̿–ᆺ ̿–)ノ
View GitHub Profile
@husseyexplores
husseyexplores / Much much simpler option selector for Shopify
Last active October 5, 2022 19:33 — forked from zakhardage/Much much simpler option selector for Shopify
Much simpler version of Shopify's option_selection.js for separating product options into their own dropdown menus.
<form action="/cart/add" method="post" enctype="multipart/form-data" class="product-form" id="AddToCartForm">
{% unless product.has_only_default_variant %}
{% for option in product.options_with_values %}
<label {% if option.name == 'default' %}class="label--hidden" {% endif %}for="SingleOptionSelector-{{ forloop.index }}">{{ option.name }}</label>
<select id="SingleOptionSelector-{{ forloop.index }}" onchange="updateVariant();">
{% for value in option.values %}
<option value="{{ value | escape }}"{% if option.selected_value == value %} selected="selected"{% endif %}>{{ value }}</option>
{% endfor %}
</select>