Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {% if product.tags contains "bis-hidden" %}
- <p class="out-of-stock">{{ settings.out-of-stock-message }}</p>
- {% else %}
- <div class="product-reorder">
- <h3>{{ settings.restock-notify-heading }}</h3>
- <p>{{ settings.restock-notify-message }}</p>
- <div class="restock-notify-form">
- <input type="email" id="notify_email"{% if customer.email != blank %} value="{{ customer.email }}"{% endif %}>
- <button id="notify_button">{{ settings.notify-me-button }}</button>
- </div>
- </div>
- {% endif %}
- <script>
- var notificationCallback = function(data) {
- var msg = '';
- if (data.status == 'OK') {
- msg = data.message; // just show the success message
- } else { // it was an error
- for (var k in data.errors) { // collect all the error messages into a string
- msg += (k + " " + data.errors[k].join());
- }
- }
- alert(msg);
- }
- $('#notify_button').click(function(e) {
- e.preventDefault();
- var email = $('#notify_email').val(),
- productId = {{ product.id }}, // rendered by Liquid
- variantId = {{ product.variants.first.id }}; // rendered by Liquid
- BIS.create(email, variantId).then(notificationCallback); // create the notification
- })
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement