• Resolved c0nd3x

    (@c0nd3x)


    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

    (@edgarrojas)

    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

    (@c0nd3x)

    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

    (@edgarrojas)

    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

    (@c0nd3x)

    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 7 years, 8 months ago by c0nd3x.
    Plugin Author EDGARROJAS

    (@edgarrojas)

    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/

    Regards!

    Thread Starter c0nd3x

    (@c0nd3x)

    Hello Edgar!

    I followed the steps you indicated me and everything worked very well.
    Thanks for your help!

    Plugin Author EDGARROJAS

    (@edgarrojas)

    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.