Creating coupons and discounts

With the help of some simple calculations, you can create coupon codes and apply discounts to your payment forms.

Creating coupons/discounts

Quick Tip

Need help getting started? Our order form template has a coupon code field set up and ready to go!

To create a coupon code or add a discount to your payment form:

  1. Add a Textbox field for customers to type in their coupon code.
  2. In your Coupon Code field settings, select Show Custom Error - When. Set an error to appear when the coupon code field is filled out, and the entered code is not correct: =(CouponCode != null and CouponCode != "SAVE10") Make sure to include a custom error message as well (“Invalid code.”)
  3. Add a Price field to calculate the discount, and enter your discount expression in the Amount section of the Price field settings: =if CouponCode = "SAVE10" then -ItemTotal* 0.10 else 0

Calculating a total using a 10% discount.

Tips

  • The example above references a payment field labelled ‘Item Total’. Make sure that you replace this field with the name of the payment field on your form. If your form contains multiple payment fields, you will need to add them up first (ex: PaymentField1 + PaymentField2 + PaymentField3). It’s important that you reference the actual payment fields on your form rather than a calculation property like Order.SubTotal. The order subtotal will automatically change once a coupon is applied; therefore, if you reference the subtotal in your coupon code calculation, the discount will not be accurate.
  • If your discount is based on a percentage, you’ll need to multiply the percentage (ex: 20%) by the payment total: =if CouponCode = "SAVE20" then -ItemTotal* 0.20 else 0
  • If your order form uses repeating sections, you’ll need to sum the total amount from each repeating item, and apply the discount to the total. You can accomplish this using the .Sum function: =if CouponCode = "SAVE 10" then -MyOrder.Sum(ItemTotal)*0.10 else 0
    Here, MyOrder is the name of the repeating section, while ItemTotal is a payment field within the repeating section.
  • To create multiple coupon codes, just combine them in a series of if/then statements: =if CouponCode = "SAVE10" then -ItemTotal* 0.10 else if CouponCode = "SAVE20" then -ItemTotal* 0.20 else 0
  • You can set quantity limits to limit the number of times a discount code can be used.