Skip to content

Instantly share code, notes, and snippets.

@msmithstubbs
Last active December 16, 2015 22:39
Show Gist options
  • Select an option

  • Save msmithstubbs/5508127 to your computer and use it in GitHub Desktop.

Select an option

Save msmithstubbs/5508127 to your computer and use it in GitHub Desktop.
Custom trigger for testing365
// 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