Using “Calculate Prices based on Distance For WooCommerce”
Summary
Flat delivery fees feel random. A clearer approach is to charge by real driving distance. If the trip is 7 km and your price is $2 per km, the delivery fee is 7 × 2 = $14—displayed at checkout. This guide shows how to set it up in minutes using a free plugin, plus tips to pick a fair per-distance rate, reduce cart abandonment, and keep your Google Maps API costs predictable.
Who should use distance-based delivery?
Distance pricing is ideal when delivery cost scales with travel time:
- Restaurants & groceries (short, frequent trips)
- Florists & bakeries (time‑sensitive deliveries)
- Couriers & local parcel dispatch
- Furniture/appliance delivery (variable routes)
If flat fees cause complaints or lost margin, distance pricing helps.
What you’ll need
- WooCommerce (latest version)
- Free plugin: Calculate Prices based on Distance For WooCommerce (WordPress.org)
- Google Maps API key (for address autocomplete + real‑distance):
Enable Geocoding, Distance Matrix, Places, Maps JavaScript, Directions.
Note: Google requires billing to activate APIs, but typical usage for small/medium stores fits within free monthly credits.
What the free plugin does (exactly)
- Gets real driving distance between your store and the customer’s address
- Multiplies distance by your price per unit (km or mile)
- Automatically adds the fee at checkout (distance × rate)
- Address Autocomplete for faster, cleaner addresses
- Works with Classic and Cart/Checkout Blocks
- Optional Date & Time Picker (free)
Example: Distance = 7 km, Rate = $2 per km → Fee = $14 added as delivery/shipping.
Step‑by‑step setup (5–10 minutes)
- Install the plugin WordPress → Plugins → Add New → search “Calculate Prices based on Distance For WooCommerce“ → Install → Activate.
- Open settings WooCommerce → WC Distance Calculator.
- Add your Google Maps API key Paste your key. Ensure the APIs listed above are enabled. Save.
- Choose units & rate Select Kilometers or Miles. Set Price per unit (e.g., 2.00 per km).
- Test the flow Add a product → go to checkout → start typing an address → select a suggestion. The delivery fee appears automatically using the formula distance × rate.
How to choose a good per‑distance rate
You’re not calculating driver pay—just a clear, fair fee that scales with distance. Try one of these:
Quick start
- Urban/short trips: $0.80–$1.20 per km (or $1.20–$1.80 per mile)
- Suburban/longer trips: $1.20–$2.00 per km (or $2.00–$3.00 per mile)
Based on your own history
- Take last month’s average delivery cost and average distance.
Example: ~$10 average cost / 8 km → $1.25 per km starting point.
Adjust anytime. If nearby customers push back, nudge down; if long trips are costly, nudge up.
Copy‑and‑paste examples
- Restaurant (city): $0.90 per km → 2 km = $1.80, 7 km = $6.30, 10 km = $9.00
- Florist (city + suburbs): $1.10 per km → 3 km = $3.30, 12 km = $13.20
- Furniture (miles): $1.50 per mile → 5 mi = $7.50, 18 mi = $27.00
Reduce cart abandonment (shipping transparency)
Customers hate surprises. Add a short line near shipping:
“Delivery fee is calculated by real driving distance—simple and fair.”
Two more tips:
- Ask for the address early (Blocks make this easier) so the fee appears before the last step.
- Keep checkout light—avoid heavy scripts and caching on the checkout page.
Google Maps API best practices (keep costs predictable)
- Restrict your API key
- Frontend key: restrict by HTTP referrers (your domain).
- Enable only the APIs you use.
- Set a budget + alerts in Google Cloud
- Get notified if usage spikes.
- Monthly check
- Review usage for sudden jumps (usually a misconfiguration; tighten referrers).
Troubleshooting quick hits
- No address suggestions? Ensure Places + Maps JavaScript are enabled and the key allows your domain.
- Fee doesn’t appear? Check Geocoding + Distance Matrix are enabled; address fields visible; Classic or Blocks checkout; clear checkout cache.
- Units wrong? Switch Kilometers/Miles in settings; the formula updates automatically.
- Change the price later? Edit Price per unit—the new rate applies immediately.
Ready‑made store copy (paste into your site)
Short note under Shipping:
Delivery fee is calculated by real driving distance.
Tip above shipping methods:
Start typing your address—your delivery fee will appear automatically.
Out‑of‑area message:
We generally deliver within 20 km of our shop. If you’re farther away, contact us—we’ll try to help.
Wrap‑up
With Calculate Prices based on Distance For WooCommerce, delivery pricing is transparent: distance × your price per km/mile. Customers understand the cost; you protect margins. Setup takes minutes—and you can adjust the rate any time.
Get started:
- WordPress.org (free): Calculate Prices based on Distance For WooCommerce
- Live Demo: demo.routepricing.com
- Setup Guide: routepricing.com/step-by-step-guide/