Automatically Apply Coupon Code
Automatically apply a coupon code during checkout on your Webflow Memberstack website.
Automatically apply a coupon code during checkout on your Webflow Memberstack website.
How to add it
- Add the Javascript code to the head custom code section
- Update COUPONCODE with your coupon code
The code
Javascript
<!-- Add to HEAD section -->
<script>
$(window).on('load', function(){
$('.ms-have-a-coupon').trigger("click");
setTimeout(function(){
var event = new Event("input", {
bubbles: true,
cancelable: true,
});
$('#msCouponId')[0].value = "COUPONCODE";
$('#msCouponId')[0].dispatchEvent(event);
$('.ms-coupon-button')[0].click();
}, 500);
});
</script>