Create a Discount Code
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;)
Formula created by EDGARROJAS
https://wordpress.org/support/topic/create-a-discount-code/
![](https://secure.gravatar.com/avatar/b52dcb37eb47243a483ed0441257e064?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)