Title: Conditional calculation
Last modified: November 30, 2023

---

# Conditional calculation

 *  Resolved [zakben](https://wordpress.org/support/users/zakben/)
 * (@zakben)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/conditional-calculation/)
 * Hello!
 * I am making a form to calculate the price of a taxi.
 * There are 3 fields: Vehicle Type (radio), From (select), To (select).
 * Considering that there is no “if” in calculations, is there a way to define the
   price based on these 3 fields? E.g: From “X” to “Y” in “Z vehicle” = 50$.
   Since
   there are many locations, the solution that requires to create a field for each
   case is not possible.
 * Thank you for your time!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [Nebu John – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport14/)
 * (@wpmudevsupport14)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/conditional-calculation/#post-17244291)
 * Hi [@zakben](https://wordpress.org/support/users/zakben/),
 * I hope you are keeping well today and thank you for reaching out to us.
 * Can you please export your form and share it with us? This will allow us to closely
   examine it and offer any suggestions that may be helpful.
 * Please share the export of the form using pastebin.com or Google Drive. I hope
   the following guide comes in handy: [https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export](https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export)
 * We look forward to hearing back from you.
 * Kind Regards,
    Nebu John
 *  Thread Starter [zakben](https://wordpress.org/support/users/zakben/)
 * (@zakben)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/conditional-calculation/#post-17244723)
 * Hello John,
 * Here is the exported form [https://pastebin.com/UaTpb9UN](https://pastebin.com/UaTpb9UN).
 * Thank you for your quick response.
 *  Plugin Support [Amin – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support2/)
 * (@wpmudev-support2)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/conditional-calculation/#post-17247886)
 * Hello [@zakben](https://wordpress.org/support/users/zakben/) ,
 * I’ve checked your form and I think the calculation is based on the distance between
   locations.
    And you would like to have those distances hardcoded to be able to
   calculate the price? Even with if…else it is around 240 combinations (if my math
   is correct ;)). To create this with Forminator will require separate fields for
   distance and calculation. I would suggest using a script like this [https://cloud.google.com/blog/products/maps-platform/how-calculate-distances-map-maps-javascript-api](https://cloud.google.com/blog/products/maps-platform/how-calculate-distances-map-maps-javascript-api)
   to calculate distance and then you can do one calculation field.
 * kind regards,
    Kasia
 *  Thread Starter [zakben](https://wordpress.org/support/users/zakben/)
 * (@zakben)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/conditional-calculation/#post-17250546)
 * Thank you for your help, I ended up building a workaround using JS.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Conditional calculation’ is closed to new replies.

 * ![](https://ps.w.org/forminator/assets/icon-256x256.gif?rev=3443182)
 * [Forminator Forms – Contact Form, Payment Form & Custom Form Builder](https://wordpress.org/plugins/forminator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/forminator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/forminator/)
 * [Active Topics](https://wordpress.org/support/plugin/forminator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/forminator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/forminator/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [zakben](https://wordpress.org/support/users/zakben/)
 * Last activity: [2 years, 6 months ago](https://wordpress.org/support/topic/conditional-calculation/#post-17250546)
 * Status: resolved