Last active
December 16, 2015 22:39
-
-
Save msmithstubbs/5508127 to your computer and use it in GitHub Desktop.
Custom trigger for testing365
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
| // add a custom trigger to the product.liquid template, right afer the add to cart button. It is hidden by default. | |
| <input type="submit" name="BIS" value="Email me when available" id="BIS_trigger" class="action_button" style="display:none;"> | |
| // then in app.js, update the selectCallback to show and hide the Add to car and trigger buttons | |
| if (variant && variant.available == true) { | |
| if(variant.price < variant.compare_at_price){ | |
| $('.was_price', $product).html(Shopify.formatMoney(variant.compare_at_price, $('form.product_form', $product).data('money-format'))) | |
| } else { | |
| $('.was_price', $product).text('') | |
| } | |
| $('.sold_out', $product).text(''); | |
| $('.current_price', $product).html(Shopify.formatMoney(variant.price, $('form.product_form', $product).data('money-format'))) | |
| $('#add-to-cart', $product).show(); | |
| $('#BIS_trigger', $product).hide(); | |
| } else { | |
| $('.was_price', $product).text('') | |
| $('.current_price', $product).text('') | |
| $('.sold_out', $product).text(message); | |
| $('#add-to-cart', $product).hide(); | |
| $('#BIS_trigger', $product).show(); | |
| $notify_form.fadeIn(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment