Formidable Forms

The Most Advanced WordPress Forms Plugin and Form Builder

  • Features
  • Pricing
  • Blog
  • Support
  • Login
  • Get Formidable Forms

How to Add a Coupon Code Field

Last Updated: July 9, 2020

Knowledge Base → Views → Examples → 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. You can use Lookup fields to accomplish this by following the directions below.

Formidable Forms is the best WordPress Form Builder plugin. Get it for free!

Step 1: Create form to add coupon code

  1. Create a form to add your coupon codes and discount amounts. We'll call this the Coupon Code List form.
    Coupon Code Field Add
  2. Add a Single Line Text field and label it Coupon Code.
  3. Add a Number field and label it Discount Amount.
  4. Submit an entry for each coupon code and discount amount that you would like. For example, you could create 10% discount for Black Friday by entering BlackFriday2016 in the Coupon Code field and .10 in the Discount Amount field.
  5. Step 2: Create a form to enter coupon code

  6. Create a new form or go to edit an existing form where users will enter the coupon codes and purchase an item.
  7. 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
  8. Add a Number field to the form and label the field 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. Set it up to watch the Coupon Code Lookup field.
    Coupon Code Field Lookup Default Value
  9. Open the field options for the field that calculates the total amount due. 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.

You're finished! Now when a user enters a valid coupon code, it will automatically discount the total. If it is not a valid coupon code, the total will not be altered.

  • Step 1: Create form to add coupon code
  • Step 2: Create a form to enter coupon code
Categories
×

Categories

  • Installation & Getting Started
  • Account Management
  • Forms
  • Entries
  • Views
  • Styles
  • Importing & Exporting
  • Add-Ons
  • Extend Formidable Forms
Install Formidable Lite

Using WordPress and want to get Formidable Forms for free?

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.

Take on bigger projects Right Now

Get the tools you need to revolutionize your workflow and architect a masterpiece. Build the most advanced WordPress forms and actually use the data you collect in meaningful ways.

Get the most advanced WordPress form plugin and the only form builder with integrated Views.

Get Formidable Forms Now

Resources

  • Community
  • Affiliates
  • Contact
  • Free Online Form Builder

Top Features

  • Front End Editor
  • Repeating Fields
  • Views from Entries
  • Calculator Forms
  • Conditional Logic
  • Visual Form Styler
  • Form Templates
  • User Submitted Posts
  • File Upload Forms
  • Spam Protection
  • Multi Page Forms
  • Surveys & Polls
  • Form Graphs & Charts
  • Save and Continue
  • Mobile Forms
  • Stripe Forms
  • PayPal Forms
  • WooCommerce Forms
  • MailChimp Forms
  • User Registration
  • Signature Forms
  • Bootstrap Forms
  • Quiz Maker
  • Zapier Forms
  • Salesforce Forms
  • HubSpot Forms
  • API Webhooks
  • Multilingual Forms
  • Directories

Company

  • About Us
  • Giving Back
  • Careers
  • Newsletter
  • Blog

Copyright © 2021 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.
Privacy Policy | Terms of Service | Sitemap

Join 300,000+ using Formidable Forms to create form-focused solutions fast. Get Started See User Reviews