WooCommerce · WordPress · Delivery

How to limit WooCommerce delivery to a radius in miles

WooCommerce shipping zones work by postcode, not distance. How I built a delivery radius for a Dover takeaway: geocoding, a 10 mile limit, fees and pickup.

Mohit Goyal 5 min readUpdated 26 Oct 2026
How to limit WooCommerce delivery to a radius in miles

To limit WooCommerce delivery to a radius, you geocode the customer's address, measure its distance from the store and only offer delivery when it falls inside your limit, with collection as the fallback. WooCommerce shipping zones cannot do this on their own because they match on postcodes, not miles. For Whitfield Service Station in Dover I wrote a small plugin that does exactly this with the Google Maps API and a 10 mile limit.

Why can't WooCommerce shipping zones handle a delivery radius?

Shipping zones were designed for parcels. A zone matches on country, region and postcode, then offers the shipping methods you attach to it. That works for "free UK delivery over £50", which is how a UK grocery marketplace I built in 2025 shipped.

Hot food is different. A takeaway delivers by distance from the kitchen, and a postcode area can be long and thin, partly inside your range and partly far outside it. You can approximate a radius with a long list of postcodes, but someone has to maintain that list, and it is still wrong at the edges.

What did the Whitfield delivery rules need to do?

Whitfield runs a Budgens store, a Fireaway pizza outlet and a doner and gyros kitchen on one forecourt, all selling through one WooCommerce checkout. The owner's rules, written down before any code:

  • Deliver only within 10 miles of the forecourt.
  • Charge a fee that reflects distance.
  • Outside the radius, do not refuse the order. Offer pickup or dine-in instead.
  • Stop all ordering when the store is closed.
  • No cash on delivery.

How does a delivery radius plugin work?

Rendering diagram…

My Delivery Restriction Checker plugin hooks into the checkout. When the customer enters an address, it is geocoded with the Google Maps API, which turns the text into coordinates. The plugin measures the distance from the store, hides the delivery method beyond 10 miles and adds the delivery fee for addresses inside it. Customers outside the radius still see pickup and dine-in, so they are not turned away.

The store owner can also close the shop or set opening hours from the admin, and an opening-hours popup on the front end tells customers when ordering is available. Nobody can order after the kitchen closes.

Should you use a plugin from the directory or write your own?

OptionGood forLimits
Postcode lists in shipping zonesA town with a few clear postcode areasWrong at the edges, and someone has to maintain the list
A distance-based shipping pluginStandard radius and per-mile feesHarder to bend when your rules have exceptions
A small custom pluginSpecific rules, fallbacks and fee changes you expect to makeYou need a developer to maintain it

On Whitfield the custom route was deliberate. The geocoding, radius and fee rules were specific enough that a bespoke plugin was smaller and easier to change than a general product. That proved itself when the owner switched from a distance-based fee to a flat fee: a small edit rather than a hunt through someone else's settings screen. My reasoning on this trade-off in general is in when should you build a custom WordPress plugin.

What decisions should you make before building a delivery radius?

Write these down in plain words. A developer can build any of them, but changing them after launch costs more than deciding up front.

  1. 1

    Pick the centre point

    The kitchen or store address. With several outlets, decide whether each has its own radius.

  2. 2

    Set the limit

    Whitfield uses 10 miles. Decide whether you mean straight-line or driving distance.

  3. 3

    Decide the fee model

    Flat, distance-based or free above a basket value. Expect to change it once you see real orders.

  4. 4

    Choose the fallback

    Collection, dine-in or a message with a phone number. Never a dead end.

  5. 5

    Set the hours

    Opening hours, closing for holidays and a way for staff to pause ordering on a busy night.

  6. 6

    Test with real addresses

    Addresses just inside and just outside the limit, plus addresses with typos.

What else does a local delivery store need?

The radius is one piece. On Whitfield, these made the system usable day to day:

  • Order printing. Orders print automatically to an Epson receipt printer through PrintNode, so the kitchen never watches a screen. I wrote that up in how to print WooCommerce orders automatically in the kitchen.
  • Express payments. A multi-step Fluid Checkout with Stripe, Apple Pay and Google Pay.
  • Add-ons. WooCommerce Product Add-Ons for toppings and variations.
  • Age checks. An 18+ confirmation for alcohol and vapes.
  • A menu staff can edit. A CSV import template with tutorial videos.

Plan for the rules to change

Whitfield's fee changed after launch and cash on delivery was switched off. Keep delivery rules in one place in code or settings, so a change is an edit, not a rebuild.

The full list of what a store needs before launch is in my WooCommerce store build checklist. I build delivery and ordering stores as part of my WooCommerce stores and online ordering service. Send me your delivery rules in plain words and I will reply with a plan.

Frequently asked

Can WooCommerce restrict delivery by distance out of the box?+

No. Core shipping zones match on country, state and postcode. Postcode lists can approximate an area, but they cannot say within 10 miles of the shop. You need a plugin that geocodes addresses.

Do I need a custom plugin for a delivery radius?+

Not always. Distance-based shipping plugins exist and suit simple cases. I wrote one for Whitfield Service Station because the radius, fee and fallback rules were specific enough that my own plugin was smaller and easier to change than bending a general product.

What happens to customers outside the radius?+

On Whitfield, delivery is hidden for addresses beyond 10 miles and the checkout falls back to pickup or dine-in, so the customer can still order.

Can the delivery fee depend on distance?+

Yes. Whitfield's plugin charged a distance-based fee at launch. The owner later moved to a flat fee, which was a small change in code I owned.

Which API do you use to geocode addresses?+

The Google Maps API on Whitfield. It turns the address the customer types into coordinates, so the distance from the store can be measured.

Mohit Goyal

Written by Mohit Goyal

Senior Web Developer in Gurugram, India. 100+ fast, SEO-friendly sites shipped in 4+ years with Next.js, React and WordPress, including the procol.ai rebuild. Send me your next project.

Keep reading

Let's build

Have a site that needs to be fast, rank and convert?

Open to Work. Usually replies within a day.