All Collections
General Questions
FAQ
Apply a coupon code to a cart after submitting a form
Apply a coupon code to a cart after submitting a form

Reward your customers for signing up for your email list!

Updated over a week ago

Webflow doesn't have an easy to way to apply coupon codes to carts automatically, so we created a custom solution! You must have the Monto header script on your site for this to work.

Its super simple:

  1. Create a coupon code in Webflow that you want to apply to carts after they fill out a form. Name it whatever you want. In this case, we created one called "HALFOFF"

2. Go to the form you want people to fill out, select the form block and ensure it has a "Name". Name it whatever you want. In this case we named it "homepageform"

3. In Webflow, go to your site's Project Settings > Custom Code section. In the Footer code, insert the following:

<script type="text/javascript">
window.onload = function() {
document.querySelector("#FORMID").addEventListener("submit", (e) => {
window.MONTO.Webflow.applyDiscountCode('COUPON')
});
}
</script>

Be sure to replace FORMID (keep the # & ") with the form ID you selected.
โ€‹Be sure to replace COUPON (keep the ' ') with the coupon code you want to use.

Here is how ours looks with examples above:

Save and publish your site!

Now when people use the form, they will automatically have the coupon code applied at checkout.

Be sure to test it out to ensure its working.

Fill out the form and add an item to cart to see if it applies the coupon.

Let Your Customers Know!

Put a message above your chosen form to let customers know that signing up will give them a discount on their order.

Did this answer your question?