Last active
December 29, 2015 08:09
-
-
Save msmithstubbs/7641239 to your computer and use it in GitHub Desktop.
Adding a Back In Stock form to Symmetry
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
| {% comment %} | |
| /* | |
| * Example code only. This code has not been tested on a live site. | |
| * IMPORTANT: Backup your theme before making any modifications. | |
| * | |
| */ | |
| {% endcomment %} | |
| {% unless product.available %} | |
| <script> | |
| var BISSubmit = function(attr) { | |
| var showResponse = function(data) { | |
| var msg = ''; | |
| if (data.status == 'Error') { | |
| for (var k in data.errors) { | |
| msg += data.errors[k].join(); | |
| } | |
| } else { | |
| msg = data.message; | |
| } | |
| alert(msg); | |
| } | |
| if (BISPopover) { | |
| BISPopover.create(BIS.$('#bis-email', attr.form).value, attr.variantId) | |
| .then(showResponse); | |
| } | |
| } | |
| </script> | |
| <form onsubmit="BISSubmit({ form: this, variantId: {{product.variants.first.id}} }); return false;"> | |
| <p>Enter your email address to receive a notification when this is available to order.</p> | |
| <input type="email" class="email" placeholder="Email Address" value="" id="bis-email" required="" name="email"> | |
| <input class="compact" type="submit" name="subscribe" value="Notify Me"> | |
| </form> | |
| {% endunless %} |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example product page notification form
You can download this file, then upload it to your theme under 'snippets'.
Then include it in product.liquid with:
This is minimal example: it doesn't handle multiple variants, and only uses an alert dialog for the confirmation and error messages.
For more information on integration with Back In Stock visit http://backinstock.org/page/customization