Code

Automatically Apply Coupon Code

Automatically apply a coupon code during checkout on your Webflow Memberstack website.

Automatically Apply Coupon Code preview

Automatically apply a coupon code during checkout on your Webflow Memberstack website.

How to add it

  1. Add the Javascript code to the head custom code section
  2. 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>

                    

Browse similar code snippets

Language

Related Webflow questions

All answers →

Similar code snippets

All code snippets →