Skip to content

Instantly share code, notes, and snippets.

@mmeo
Created December 5, 2016 17:53
Show Gist options
  • Save mmeo/07308187ac287d52d86cbc23f0a7c8cc to your computer and use it in GitHub Desktop.
Save mmeo/07308187ac287d52d86cbc23f0a7c8cc to your computer and use it in GitHub Desktop.
function ChangeCouponMessage()
{
//define the coupon value entered by user
var coupon = $("#subscription_coupon_code").val();
//if the coupon ends with some value (for example, "abc") then apply the specific coupon message.
//The end of the coupon is used so the full coupon name does not appear in the source code
if (coupon.match("abc$")) {
coupon_text = $('#long_coupon_message').find(".success_message");
coupon_text2 = coupon_text.text("Coupon Message Example 1")
}
//else if, the coupon ends with "def", put another coupon message
else if (coupon.match("def$")) {
coupon_text = $('#long_coupon_message').find(".success_message");
coupon_text2 = coupon_text.text("Coupon Message Example 2")
}
};
$(document).bind("afterSummaryRefresh", ChangeCouponMessage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment