How to add fares like uber?

Hello fellow bubblers, im building a delivery app and would like to know how to calculate how much $ per km.

Thank you.

You need to decide as a business owner how much to charge per KM…then you need to save that value somewhere, an option set is a good choice…then you need to calculate distance in KM between two addresses and then multiply by your price per KM.

So basically multiply the option set by the km right?

Yes…when creating the option set you will need to add an attribute of type number…so you may want to have a display value of ‘cost per km’ and then the attribute number value is the actual value so maybe something like 0.15 (I use USD so this would be $0.15 per km).

Then when you have the distance in KM between two address take that number and multiply by the option set number attribute value. You can then also use the format as operator to change from number display to a currency display with the chosen currency symbol at the beginning.

Done i already have it working thank you so much.

1 Like