Skip to content

Instantly share code, notes, and snippets.

@kyledurand
Last active August 29, 2015 14:11
Show Gist options
  • Save kyledurand/364d437df5c0ecea5b22 to your computer and use it in GitHub Desktop.
Save kyledurand/364d437df5c0ecea5b22 to your computer and use it in GitHub Desktop.
Allow for featured image to be displayed by default in variant images core
{% assign featured_image = product.featured_image | default: product.featured_image %}
//wrap switch image in function
$('.single-option-selector').change(function(){
if (variant.featured_image) {
var newImage = variant.featured_image;
etc..
}
});
//add this below new optionSelectors
{% if product.variants.size > 1 %}
{% for option in product.options %}
$('.single-option-selector:eq({{ forloop.index0 }})')
.filter(function() { return $(this).find('option').size() > 1 })
.prepend('<option value="">Choose ' + {{ product.options[forloop.index0] | json }} + '</option>')
.val('')
//hide this next line or it will interfere with callback code above
//.trigger('change');
{% endfor %}
{% endif %}
@kyledurand
Copy link
Author

Super Hacky. Not recommended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment