Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shopifypartners/88d725ea630d17dac6fffb788d8515be to your computer and use it in GitHub Desktop.
Save shopifypartners/88d725ea630d17dac6fffb788d8515be to your computer and use it in GitHub Desktop.
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