Last active
December 20, 2015 03:39
-
-
Save msmithstubbs/6065703 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
| {% if product.available %} | |
| <style> | |
| #BIS_trigger { display: none; } | |
| </style> | |
| {% endif %} | |
| <script type="text/javascript"> | |
| var selectCallback = function(variant, selector) { | |
| if (variant && variant.available == true) { | |
| // selected a valid variant | |
| $('#productinfo #detail #purchase').removeClass('disabled').removeAttr('disabled'); // remove unavailable class from add-to-cart button, and re-enable button | |
| var newHtml = Shopify.formatMoney(variant.price, ""); | |
| if(variant.compare_at_price > variant.price) { | |
| newHtml += '<div class="was-price">was ' + Shopify.formatMoney(variant.compare_at_price, "") + '</div>'; | |
| } | |
| $('#price-field').html(newHtml); // update price field | |
| $('#BIS_trigger').hide(); // added for Back In Stock | |
| } else { | |
| // variant doesn't exist | |
| $('#productinfo #detail #purchase').addClass('disabled').attr('disabled', 'disabled'); // set add-to-cart button to unavailable class and disable button | |
| var message = variant ? "Sold Out" : "Unavailable"; | |
| $('#price-field').text(message); // update price-field message | |
| $('#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