Forked from sarachisholm/four-smart-reasons-to-embed-shopify-store-updates.js
Last active
March 17, 2017 19:15
-
-
Save shopifypartners/88d725ea630d17dac6fffb788d8515be to your computer and use it in GitHub Desktop.
Store updates JavaScript for Shopify Buy Button - https://www.shopify.com/partners/blog/four-smart-reasons-to-embed-a-shopify-store-in-your-client-websites
This file contains 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
var variantSelectors = generateSelectors(product); | |
$('.variant-selectors').html(variantSelectors); | |
function generateSelectors(product) { | |
var elements = product.options.map(function(option) { | |
return '<select name="' + option.name + '">' + option.values.map(function(value) { | |
return '<option value="' + value + '">' + value + '</option>'; | |
}) + '</select>'; | |
}); | |
return elements; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment