• Resolved rpalex

    (@rpalex)


    We have a registration form for an event with two ticket options.

    If there is only a total of one person, then the price will be $15.
    If there is 2 or more persons, then the price will be $30

    There are two fields for the number of Persons

    Adults Count: {select-1 }
    Children count: {select-2}

    So if {select-1}+{select-2} = 1, then payment amount is $15.00
    But if {select-1}+{select-2} >= 2, then payment amount is $20.00

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Zafer – WPMU DEV Support

    (@wpmudevsupport15)

    Hi @rpalex,

    I hope you are doing well today!

    It seems there is a difference between your first conditions and the second, please confirm again if the total will be $30 or $20 for the total number of people if it is >= 2.

    It is also better to use number fields for that instead of select;
    https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#number-field

    Therefore, please provide your query again more clearly so that we can help by creating an example form for you, and you can import it to have a look and modify.

    Kind regards,
    Zafer

    Thread Starter rpalex

    (@rpalex)

    ?? yes sorry there is an inconsistency, but the value there is irrelevant, it is just used to show that a different price is calculated when it is >= 2. In my example, yes, it should be 30.

    I could use number fields, but I wanted to limit the number and also wanted to show

    1 Adult
    2 Adults
    3 Adults etc., which is possible only with Select fields.

    Plugin Support Dmytro – WPMU DEV Support

    (@wpmudevsupport16)

    Hello @rpalex,

    Thanks for the explanation.

    Although there’s no options to put conditions directly in the formula, it’s possible to use visibility conditions for displaying the payment amount.

    Here’s an example form I’ve created, which you can import and test on your site:
    https://pastebin.com/qtMUPZB8

    – in order to import it, just copy the code, in the Forms section press the “Import” button, and paste it in the popup that appears.

    There are 3 calculation fields in this form:

    – the first one is for calculating the total amount of people;

    – the other two calculation fields (conditionally visible) are for displaying the payment amount, based on the amount of people. You can put the corresponding payment amount in each of these fields ( 15 and 30 ).

    The visibility conditions are used to display the right payment amount:

    https://prnt.sc/7bsQi-W0WYnE

    I hope this helps. Let us know if you have any questions!

    Best Regards,
    Dmytro

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @rpalex,

    Since we haven’t heard from you for a while. I’ll mark this thread as resolved for now. Please feel free to re-open the thread if you need further assistance.

    Best Regards
    Nithin

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Is it possible to do a Conditional Calculation’ is closed to new replies.