Skip to content

Instantly share code, notes, and snippets.

@msmithstubbs
Created July 23, 2013 21:28
Show Gist options
  • Select an option

  • Save msmithstubbs/6066337 to your computer and use it in GitHub Desktop.

Select an option

Save msmithstubbs/6066337 to your computer and use it in GitHub Desktop.
var selectCallback = function(variant, selector) {
if (variant && variant.available) {
jQuery('#add-to-cart').removeAttr('disabled').removeClass('disabled'); // remove unavailable class from add-to-cart button, and re-enable button
if(variant.price < variant.compare_at_price){
jQuery('#price-preview').html(Shopify.formatMoney(variant.price, "{{amount_no_decimals}} &#1088;&#1091;&#1073;.") + " <del>" + Shopify.formatMoney(variant.compare_at_price, "{{amount_no_decimals}} &#1088;&#1091;&#1073;.") + "</del>");
} else {
jQuery('#price-preview').html(Shopify.formatMoney(variant.price, "{{amount_no_decimals}} &#1088;&#1091;&#1073;."));
}
$('#BIS_trigger').hide(); // added for Back In Stock app
} else {
jQuery('#add-to-cart').addClass('disabled').attr('disabled', 'disabled'); // set add-to-cart button to unavailable class and disable button
var message = variant ? "Распродано" : "Unavailable";
jQuery('#price-preview').text(message);
$('#BIS_trigger').show(); // added for Back In Stock app
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment