Skip to content

Instantly share code, notes, and snippets.

@Tetsuro
Created February 17, 2013 16:42
Show Gist options
  • Save Tetsuro/4972164 to your computer and use it in GitHub Desktop.
Save Tetsuro/4972164 to your computer and use it in GitHub Desktop.
Radio Buttons for Single Option Products
<div class="variant-radios">
{% for variant in product.variants %}
<input type="radio" name="id" value="{{ variant.id }}" data-price="{{ variant.price }}" id="{{ variant.id }}"/>
<label for="{{ variant.id }}">{{ variant.title }}</label>
{% endfor %}
</div>
<script>
jQuery(".variant-radios input").click(function(){
var price= jQuery(this).attr('data-price');
console.log(price);
jQuery('.product-price').html(Shopify.formatMoney(price, "{{ shop.money_format }}"));
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment