Skip to main content
Distance rates price shipping on how far the customer is from your origin, measured in kilometres. They suit local delivery, furniture, and anything you deliver with your own vehicles.
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.
Leave the final band’s Range End empty. Without it, a customer beyond your furthest band gets no rate at all — which on a distance rate means anyone unusually far away silently loses their shipping option.

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.
Google bills per request. A busy checkout generates a lot of them. Review Google’s pricing and set a quota so an unexpected traffic spike doesn’t produce an unexpected bill.
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

  1. Check out to an address close to your origin and confirm the nearest band applies
  2. Try one far away and confirm the correct band — or no rate, if that’s intended
  3. Test a boundary distance to confirm your bands don’t overlap or leave a gap
  4. Use a fresh address each time, since rates are cached per address

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.