Created
July 19, 2013 16:51
-
-
Save msmithstubbs/6040650 to your computer and use it in GitHub Desktop.
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
| // Example code only | |
| // This hasn't been tested on a real site. Please backup your theme before making any changes. | |
| 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}}") + " <del>" + Shopify.formatMoney(variant.compare_at_price, "${{amount}}") + "</del>"); | |
| } else { | |
| jQuery('#price-preview').html(Shopify.formatMoney(variant.price, "${{amount}}")); | |
| } | |
| } else { | |
| jQuery('#add-to-cart').addClass('disabled').attr('disabled', 'disabled'); // set add-to-cart button to unavailable class and disable button | |
| var message = variant ? '<input type="button" id="BIS_trigger" class="btn" value="Email me when in stock">' : "Unavailable"; | |
| jQuery('#price-preview').html(message); | |
| } | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment