Because I needed conditional logic to ask for attendee names, I built each product as a number element and used a formula to add for total due. It app

  • Wendy Stoneberger
    Asked on January 23, 2024 at 8:55 PM

    Because I needed conditional logic to ask for attendee names, I built each product as a number element and used a formula to add for total due. It appears that when Payment Type is a User Defined Amount, the options at the top for Coupon are not available. Is that true? Is there another way to use a discount code?

  • William JotForm Support
    Replied on January 23, 2024 at 11:41 PM

    Hi Wendy,

    Thanks for reaching out to Jotform Support. Yes, when the payment field is set to user-defined amount, it will not have the discount codes option. So what you can do is set your own using conditions and perform a calculation using a form calculation widget.

    The first thing that you can do is add a field in your form that will act as a discount coupon. Next is create a condition that if the entered value matches then you can perform some calculation on your form that will discount the amount from the total. Here is to give you a clearer idea on this:

    1. On your form prepare the following:
    2. subtotal amount field - for your product purchases
    3. discount coupon field - for entering the coupon code
    4. discount rate field - for the rate of discount
    5. calculation widget - for your total amount that you will transmit to the payment field
    6. the payment field set as user-defined

      Because I needed conditional logic to ask for attendee names, I built each product as a number element and used a formula to add for total due Screenshot 70
    7. Next, create a condition for your coupon code that if a code matches then pass on the data to your discount rate. Here is a sample condition for this:
      Because I needed conditional logic to ask for attendee names, I built each product as a number element and used a formula to add for total due Screenshot 81
      For this example, I have created two conditions for the coupon:
      Because I needed conditional logic to ask for attendee names, I built each product as a number element and used a formula to add for total due Screenshot 92
    8. Next, I have set a formula for the calculation widget like this:

      subtotal - (subtotal * .[discount rate])

      Because I needed conditional logic to ask for attendee names, I built each product as a number element and used a formula to add for total due Screenshot 103
    9. Next, proceed on editing your payment field where you will set the Get Price From on that total field with the calculation
      Because I needed conditional logic to ask for attendee names, I built each product as a number element and used a formula to add for total due Screenshot 114

    Once you have properly set the fields you will see the form would automatically calculate a discount once a coupon is correctly entered:

    Because I needed conditional logic to ask for attendee names, I built each product as a number element and used a formula to add for total due Screenshot 125

    Just a final note: You can also hide the discount rate field so that it will not appear in your form and it will still properly calculate your total.

    Let us know if you have more questions or need more help.