Last active
December 19, 2015 10:49
-
-
Save msmithstubbs/5943012 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 code has not been tested on a live site. | |
| * IMPORTANT: Backup your theme before making any modifications. | |
| * | |
| */ | |
| var selectCallback = function(variant, selector) { | |
| if (variant && variant.available == true) { | |
| jQuery('#add-to-cart').removeAttr('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, "") + " <del>" + Shopify.formatMoney(variant.compare_at_price, "") + "</del>"); | |
| } else { | |
| jQuery('#price-preview').html(Shopify.formatMoney(variant.price, "")); | |
| } | |
| jQuery('#BIS_trigger').hide(); // added for Back In Stock | |
| } else { // variant does not exist | |
| jQuery('#add-to-cart').attr('disabled', 'disabled'); // set add-to-cart button to unavailable class and disable button | |
| var message = variant ? "Sold Out" : "Unavailable"; | |
| jQuery('#price-preview').text(message); | |
| jQuery('#BIS_trigger').show(); // added for Back In Stock | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment