• Resolved shah8384

    (@shah8384)


    Hi!

    I need to create a payment form that includes a small calculation. I’ve already connected my Stripe and PayPal accounts.

    The details of the form are as follows:

    for a service we can call “Vastu Consultation,” there is a fixed fee of $500. However, there is a condition and calculation that needs to be added to the final cost: the user must select the quantity of floors, with a per-floor cost of $50. There is also a minimum floor requirement. So, when the user selects the number of floors—let’s suppose 1—the final payable amount at the payment step should be $550.

    I need help with this and thank you in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @shah8384

    I hope you’re well today!

    This can be achieved easily with just a single calculation field and a single “number” field (for floor quantity selection) like this:

    – add a “number” type field to the form, set its “minimum” limit to your minimum number of floors and make sure that calculations option is enabled; let’s say it’s a “number-1” field;

    – add a calculation field to the form and set its calculation formula to

    ({number-1}*50)+500

    and that’s it. You can now use your calculation field as a payment amount value source in PayPal and/or Stripe field.

    —–

    An alternative way that uses more fields but may be a bit nicer in terms of breaking down costs and showing them to customers is to use more calculation fields. It would also let you edit prices easier in case you’d like to change them:

    – add one calculation field for base price and set calculation formula to 500 (let’s say it’s calculation-1)
    – ad another calculation field for “per floor” price and set calculation formula to 50 (let’s say it’s calculation-2)
    – add a number field for number of floors (again set its limits and enable calculations), let’s say it’s number-1
    – add another calculation field for “calculated total floors price” (let’s say it’s calculation-3) and set its calculation formula to

    {number-1}*{calculation-2}

    – add another calculation field for total price (let’s say it’s calculation-4) and set its formula to

    {calculation-1}+{calculation-3}.

    Again, you can now use that total price (calculation-4) as a source of payment value.

    Since this example is a bit more complex, I’ve prepared example form for you (note that field IDs are different in it but the principle is the same) so you could import it to your site, test it and check fields settings to see exactly how it’s made.

    You can find import code here for this example here:

    https://pastebin.com/MnSpRjRH

    Best regards,
    Adam

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @shah8384

    We haven’t heard from you in a while, I’ll go and mark this thread as resolved. If you have any additional questions or require further help, please let us know!

    Kind Regards,
    Kris

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.