Cognito-forms – How to apply a discount code to the entire order amount in Cognito Forms

cognito-forms

I am creating a form for ordering an unlimited amount of a customized product (as shown in the picture). enter image description here

I am trying to create a Discount Code (ANT20) that will take 20% off of the ENTIRE FORM TOTAL (not per item since the amount of items created is endless). I understand the coding for creating the calculations, but as you can see, it does not understand the field name 'total'. In fact, it doesn't understand any field names that I have attempted to use. I'm shooting in the dark because there is no way to find the actual field name of 'subtotal', or 'amount due', etc.

enter image description here

This has to be an easy fix. I can't imagine the coders creating a sales form that cannot have a % of the entire order being taken off. Please help!

Best Answer

You have two options for applying discounts to the entire order amount in Cognito Forms:

  1. Add additional fees and specify a negative percentage for a fixed discount amount.

    enter image description here

  2. Calculate the order subtotal before the discount using a calculation, and apply the discount to this subtotal. In your case the subtotal calculation would be =AddYourMeals.Sum(Total), and the discount calculation would be:

    =if CouponCode = "ANT20" then -0.2 * AddYourMeals.Sum(Total) else 0.

While you can access the order subtotal using this calculation, =Order.OrderAmount, you cannot apply a discount based on this amount because the discounts reduce the order amount.