This rate type needs a Google Maps API key. Distances are calculated through Google’s mapping service rather than estimated from postcodes.
Setting one up
1
Get a Google Maps API key
Create one in the Google Cloud Console with the distance and geocoding services enabled. Google bills for usage, so review their pricing before going live.
2
Add a rate and choose Distance
In your rule, click Add rate and set Calculation parameter to Distance.
3
Enter your API key
Paste it into Google maps API key.
4
Set your origin
Under Origin Location, give the Country and Postcode you deliver from.
5
Choose the calculation method
Distance calculation method (in kilometers) decides how the distance is measured.
6
Set a Rate Type and prices
Distance behaves like any other numeric parameter — pick Range, Incremental, Range + Incremental, or Range + Range, and price the bands.
Pricing by distance
Distance pairs naturally with the standard rate types: Range gives you delivery bands — the usual shape for local delivery:
Incremental charges per kilometre — a base price plus an amount for every km beyond a starting point. See Incremental / Per Item Rates.
Restricting your delivery radius
A distance rate alone doesn’t stop someone far away from ordering — it just prices them. To decline delivery beyond a radius, cap your bands at that distance and don’t add an open-ended final band, so no rate is produced past it.Cost and reliability
Every rate query calls Google, which has two consequences worth planning for. If Google is unavailable, the distance cannot be calculated. Test what your checkout does in that case before relying on distance rates as your only option.Testing
- Check out to an address close to your origin and confirm the nearest band applies
- Try one far away and confirm the correct band — or no rate, if that’s intended
- Test a boundary distance to confirm your bands don’t overlap or leave a gap
- Use a fresh address each time, since rates are cached per address
Related
Ranged Rates
Building the distance bands.
Incremental rates
Charging per kilometre.
Location conditions
Routing rules by warehouse origin.
Maximum and minimum
Bounding a distance calculation.
