Adding a Coupon Code Field to Your Form

Written by Formstack on March 30, 2011

Posted in Form Hacks

We have a help page on adding a discount code to your form already, but some users are still confused on how to do this, so I thought I’d do a more in-depth post on the topic.

For the Formstack discount code plugin to work, you need at least two fields on your form:  a Total field that automatically calculates a total and a short answer field to serve as your coupon code field.  Where people usually get stuck, is that they don’t know how to create a calculating form field for their Total.  Without getting too complicated, any short answer, number, select list, radio button, or checkbox field that contains a number(s) can be added, subtracted, multiplied or divided by any other short answer, number, select list, radio button, or checkbox field to create a total.

So let’s say we are charging $10 for t-shirts.  We could create a total field in a couple of different ways.  First, we could add a number field to our form with a default value of $10 and then multiply that by our Quantity field to get a Total.

Or, instead of multiplying Price * Quantity, we could “Use Separate Values” to add the dollar values to our Quantity field, like so:

Then the Total field would look like this:

So once we have a Total field on our form, the next step is to add a Short Answer field to use as our discount/coupon code field.

Assuming we used the first method described above, with a price and quantity field, our form now looks something like this:

Now, we’re going to click on Settings > Plugins and click the Add button next to Discount Codes.

After that, we choose which field is our discount code field and which field is our Total field from the drop-down lists provided.

Finally, we can add our discount codes.  There are two types of codes we can add, a percentage off or a flat dollar amount off.  To add a percentage off code, choose the % symbol and to add a flat dollar amount off, choose the — symbol.

To add additional discount codes, hit the green plus button next to the code field.  To delete codes, hit the red minus button.

Now when you view your actual form and type in one of your discount codes, then click “Apply Code”, your Total field will change to reflect the discount and the new Total will be displayed:

If you have any questions about discount codes or anything else Formstack-related, feel free to contact us.