Skip to content

Instantly share code, notes, and snippets.

@nstone101
Created November 12, 2020 07:42
Show Gist options
  • Save nstone101/34ad2ffb11db5677c318a290e722a91b to your computer and use it in GitHub Desktop.
Save nstone101/34ad2ffb11db5677c318a290e722a91b to your computer and use it in GitHub Desktop.
var products = ["TITLE1", "TITLE2", "TITLE3"];
$( ".btn-coupon" ).click(function(e) {
$( ".cart-line-items-v2 li" ).each(function() {
var productTitle = $(this).find(".line-title").text();
console.log("Product Title: " + productTitle);
for (i = 0; i < products.length; i++) {
if (productTitle == products[i]) {
e.preventDefault;
break;
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment