Skip to content

Instantly share code, notes, and snippets.

@aatronco
Last active September 12, 2021 15:21
Show Gist options
  • Save aatronco/c7a72d6e88ec84ee972e894fccf9a895 to your computer and use it in GitHub Desktop.
Save aatronco/c7a72d6e88ec84ee972e894fccf9a895 to your computer and use it in GitHub Desktop.
var callbackFunction = function() {
console.log("Coupon " + discount + " added")
}
var add_url_coupon = function() {
queryString = window.location.search;
urlParams = new URLSearchParams(queryString);
if (urlParams.has('discount')) {
discount = urlParams.get('discount')
Jumpseller.addCouponToCart(discount, {
callback: callbackFunction
})
}
}
$(document).ready(add_url_coupon);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment