Title: create a discount code
Last modified: April 1, 2017

---

# create a discount code

 *  Resolved [c0nd3x](https://wordpress.org/support/users/c0nd3x/)
 * (@c0nd3x)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/create-a-discount-code/)
 * Hello!
 * I create a payment form with smartForms, I want to create in this form a field
   where users can put a discount code and lower the cost of payment depending on
   the code.
    Can you help me with this? Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [EDGARROJAS](https://wordpress.org/support/users/edgarrojas/)
 * (@edgarrojas)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/create-a-discount-code/#post-8982974)
 * Hello!
 * I think this can be done in the donation formula ( in the smart donations tab)
   do you want to reduce it by a fixed amount or a percentage? and are you going
   to use only one code or multiple ones?
 *  Thread Starter [c0nd3x](https://wordpress.org/support/users/c0nd3x/)
 * (@c0nd3x)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/create-a-discount-code/#post-8982978)
 * Hello Edgar
    Thanks for your reply!
 * I want to reduce it to a fixed amount and would be two discount codes
 * Thank you so much
 *  Plugin Author [EDGARROJAS](https://wordpress.org/support/users/edgarrojas/)
 * (@edgarrojas)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/create-a-discount-code/#post-8983835)
 * Okay, this formula should do the trick (which you can put in the ‘Setup donation
   formula’ pop up, in the smart donations tab btw):
 * (function(){var discount=0;
    if([field rnField1]==’Code1′) discount=50; if([field
   rnField1]==’Code2′) discount=100; return [field rnField2]-discount; }())
 * You just need to do these changes:
    1.-Change code1 and code2 with the real coupon
   codes that you want to use 2.-Change rnField1 with the id of the field that will
   hold the coupon code 3.-Change rnField2 with the field that will hold the donation
   amount, if the donation amount is a fixed amount you can replace it with the 
   fixed amount (e.g. [field 100-discount;)
 * Hope this helps but if it doesn’t please let me know =).
 *  Thread Starter [c0nd3x](https://wordpress.org/support/users/c0nd3x/)
 * (@c0nd3x)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/create-a-discount-code/#post-8983957)
 * Hello Edgar!
    Thank you very much for your formula, it works very well!! :D. 
   In my form I have a field that shows the cost that the user will pay, if the 
   formula is in the ‘Setup donation formula’, the user will not be able to see 
   his discount before clicking on the pay button. is It possible to put the formula
   in the total field?, being the fixed amount of (800*Amount of people) and the
   discounts would be of fixed amount of (500*Amount of people) and (700*Amount 
   of people)
 * Thank you!
    -  This reply was modified 9 years, 1 month ago by [c0nd3x](https://wordpress.org/support/users/c0nd3x/).
 *  Plugin Author [EDGARROJAS](https://wordpress.org/support/users/edgarrojas/)
 * (@edgarrojas)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/create-a-discount-code/#post-8985001)
 * Hello!
 * That should be possible, the same formula should work just fine if you put it
   in any other field.
 * Btw, if you are not sure how to add it to another field, please check the tutorial
   Creating formulas here: [https://smartforms.rednao.com/tutorials/](https://smartforms.rednao.com/tutorials/)
 * Regards!
 *  Thread Starter [c0nd3x](https://wordpress.org/support/users/c0nd3x/)
 * (@c0nd3x)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/create-a-discount-code/#post-8985317)
 * Hello Edgar!
 * I followed the steps you indicated me and everything worked very well.
    Thanks
   for your help!
 *  Plugin Author [EDGARROJAS](https://wordpress.org/support/users/edgarrojas/)
 * (@edgarrojas)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/create-a-discount-code/#post-8986671)
 * Great =).
 * Let me know if you have any other question or issue and if you have a moment 
   please don’t forget to review the plugin, that really helps.
 * Regards!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘create a discount code’ is closed to new replies.

 * ![](https://ps.w.org/smart-forms/assets/icon-256x256.jpg?rev=1226707)
 * [Smart Forms - when you need more than just a contact form](https://wordpress.org/plugins/smart-forms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/smart-forms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/smart-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/smart-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/smart-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/smart-forms/reviews/)

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [discount](https://wordpress.org/support/topic-tag/discount/)
 * [formula](https://wordpress.org/support/topic-tag/formula/)
 * [smartforms](https://wordpress.org/support/topic-tag/smartforms/)

 * 7 replies
 * 2 participants
 * Last reply from: [EDGARROJAS](https://wordpress.org/support/users/edgarrojas/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/create-a-discount-code/#post-8986671)
 * Status: resolved