Docs & Support

Learn about all the Formidable features and get support from our amazing customer success team.

ViewsView Examples
How to Add a Coupon Code Field

How to Add a Coupon Code Field

Adding a coupon code field to your form is useful if you want to allow users to enter a coupon code that automatically deducts the discount amount from the Total amount. Follow the directions below to use Lookup fields to accomplish this.

Step 1: Create a form to add coupon code

This guide will help you create and use a form to manage your coupon codes and their corresponding discount amounts.

  1. Create a form called the Coupon Code List form that allows you to enter and store information about each discount offer.
    • Add a Text field labeled Coupon Code.
    • Add a Number field labeled Discount Amount.

    Create form for coupon code fields

  2. Enter a separate entry for each coupon code and its discount amount. For example, to create a 10% discount for Black Friday, enter
    BlackFriday2016

    in the Coupon Code field and

    .10

    in the Discount Amount field. Submit Coupon Code and discount amount for each entry

  3. Once you submit the form, the entries will appear on the form Entries page. Coupon Code Field Add Entry
    Note: Be sure to submit a form entry for each coupon code, as this will provide users with the data they need to find available discounts.
  4. Formidable Forms makes advanced site building simple. Launch forms, directories, dashboards, and custom WordPress apps faster than ever before.

    Step 2: Create a form to enter coupon code

  5. Create a new form or edit an existing form where users will enter the coupon codes and purchase an item.
  6. Add a Lookup → Single Line Text field and label the field Coupon code. Coupon Code Field Lookup Text Field Set it up to search values from the Coupon Code List → Coupon Code field. Coupon Code Field Lookup Search Values
  7. Add a Number field to the form and label it Discount Amount. Select the Read only checkbox to prevent users from changing the discount amount. Coupon Code Field Discount Amount In the field options, select Default Value and click the search icon to get the Lookup default value settings. Set it up to get values from the Coupon Code List → Discount Amount field and watch the Coupon Code Lookup field. Coupon Code Field Lookup Default Value
  8. Add a Number field and label it Total. Select Default Value (Calculation) and click the calculator icon. Your calculation will include something like:
    [x]-([x]*[y])

    Coupon Code Field Total Discount Calculation Replace x with the ID of the field that determines the amount due and replace y with the ID of the Discount Amount field.

    If the amount is not included in a field, replace [x] with the amount. For example, if the regular price is $100, use 100-(100*[225]). Replace 225 with the ID of the Discount Amount field.

That's it! When a user enters a valid coupon code, the Total amount will automatically be discounted. If it is not a valid coupon code, the Total amount will remain the same.

Was this article helpful? *

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

In this article

    We have a small, but amazing team of dedicated people who are committed to helping you achieve your goals and project requirements.


    Copyright © 2025 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.

    Join 400,000+ using Formidable Forms to create form-focused solutions fast. Get Formidable Forms