Created
February 17, 2013 16:42
-
-
Save Tetsuro/4972164 to your computer and use it in GitHub Desktop.
Radio Buttons for Single Option Products
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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