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/