Last active
August 29, 2015 14:08
-
-
Save msmithstubbs/0a8bc4f170dedb0da9e1 to your computer and use it in GitHub Desktop.
Back In Stock form for Shopify Simple theme
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
| <div class="BIS_container"> | |
| <p>Be the first to know when this is available to order again.</p> | |
| <input type="text" name="BIS_email" class="BIS_email" placeholder="email address"> | |
| <input type="button" class="btn BIS_button" value="Email when available"> | |
| <p class="BIS_response"> </p> | |
| </div> | |
| <script> | |
| $(function() { | |
| $('.BIS_container').on('click', '.BIS_button', function(e) { | |
| var $container = $(e.delegateTarget), | |
| email = $container.find('.BIS_email').val(), | |
| variantId = $container.closest('form').find('[name=id]').val(); | |
| BISPopover.create(email, variantId).then(function(data) { | |
| var message = ''; | |
| if (data.status == 'OK') { | |
| message = data.message; | |
| } else { | |
| for (var k in data.errors) { | |
| message += data.errors[k].join(); | |
| } | |
| } | |
| $container.find('.BIS_response').text(message); | |
| }); | |
| }); | |
| }); | |
| </script> |
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
| /* Change Add to cart at line 57 from: */ | |
| <input type="submit" value="Add To Cart" id="add" class="btn add-to-cart" /> | |
| /* to: */ | |
| {% if product.available %} | |
| <input type="submit" value="Add To Cart" id="add" class="btn add-to-cart" /> | |
| {% else %} | |
| <h2>Sold out</h2> | |
| {% include 'back-in-stock' %} | |
| {% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment