Last active
December 15, 2015 07:19
-
-
Save msmithstubbs/5223114 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
| var selectCallback = function(variant, selector) { | |
| if (variant && variant.available == true) { | |
| // selected a valid variant | |
| jQuery('#add-to-cart').removeClass('disabled').removeAttr('disabled').val('Add to Cart'); // 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) + " <span>was " + Shopify.formatMoney(variant.compare_at_price) + "</span>"); | |
| } else { | |
| jQuery('#price-preview').html(Shopify.formatMoney(variant.price)); | |
| } | |
| jQuery('#BIS_trigger').hide(); // This line added for Back In Stock app | |
| } else { | |
| // variant doesn't exist | |
| var message = variant ? "Sold Out" : "Unavailable"; | |
| jQuery('#add-to-cart').addClass('disabled').attr('disabled', 'disabled').val('Sold Out'); // set add-to-cart button to unavailable class and disable button | |
| jQuery('#product .variants .price').text(message); // update price-field message | |
| jQuery('#BIS_trigger').show(); // This line added for Back In Stock app | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment