Viewing 12 replies - 1 through 12 (of 12 total)
• Yes, you can do any arithmetic operations with the calculated distance.

For example, if your price is 3€ / km, you can use it in your formula.

`Price: [calculation total precision:2 "3 * fn_distance(start, finish, km)"]`

Thank you.

Do I need any Google Maps subscription to do this?

• Maps JavaScript API
• Distance Matrix API

Hi, Thank you.

It’s possible set this?
in formula:

1-5 km = 15€
5-15 km = 25€
15-35 km = 35€
35-50 km = 45€

Thank you

Yes, the Pro version lets you calculate the distance and then pass it to a custom PHP function to do more complex calculations (such as if/else conditional logic).

Example:

``````Starting address: [address start]
Distance (km): [calculation distance precision:2 "fn_distance(start, finish, km)"]
Price (€): [calculation price "fn_php(if (\$_POST{'distance'} > 35) { return 45; } elseif(\$_POST{'distance'} > 15) { return 35; } elseif (\$_POST{'distance'} > 5) { return 25; } else { return 15; })"]
[calculate_button "Calculate"]``````

Thanks

This is the correct formula to do this?

1-5 km = 15€
5-15 km = 25€
15-35 km = 35€
35-50 km = 45€

``````Starting address: [address start]
Distance (km): [calculation distance precision:2 "fn_distance(start, finish, km)"]
Price (€): [calculation price "fn_php(if (\$_POST{'distance'} > 35) { return 45; } elseif(\$_POST{'distance'} > 15) { return 35; } elseif (\$_POST{'distance'} > 5) { return 25; } else { return 15; })"]
[calculate_button "Calculate"]``````

Yes, this code should work fine. If you plan to use the custom PHP code features provided by the plugin, I would recommend to make sure you have a developer who can understand and maintain the code to make sure everything is running and kept secure.

Cheers,
Petko

Thank you

Hi, need a developer to apply this formula in my website?

or with an copy & paste work fine?

Copy/paste will work fine if you do not need to make any changes and if you do not run into any unexpected problems. I can provide support for the plugin itself, but I am not able to maintain or support the actual forms you create with it.

Thanks 👍

Hi,