Skip to content

Instantly share code, notes, and snippets.

@msmithstubbs
Created April 16, 2014 13:47
Show Gist options
  • Select an option

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

Select an option

Save msmithstubbs/10878145 to your computer and use it in GitHub Desktop.
Add Back In Stock button to the product page for the Shopify Timber theme
<input type="submit" name="add" class="btn" id="addToCart" value="Add to Cart">
<input type="button" name="bis" class="btn-secondary" id="BIS_trigger" value="Email when available">
if (variant.available) {
// We have a valid product variant, so enable the submit button
addToCart.removeClass('disabled').removeAttr('disabled').val('Add to Cart');
} else {
// Variant is sold out, disable the submit button
addToCart.val('Sold Out').addClass('disabled').attr('disabled', 'disabled');
}
// rest of the function continues...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment