Finding the nearest store

Docs

A new section, Finding the nearest store, says how to find the store closest to the person before you build a cart. The quickstart and the cart example now build with a placeId rather than a restaurant name and a city.

Why it matters

Coordinates measure distance from the person. A city sent as near measures it from the centre of that city instead, so the first result is not necessarily the closest to the person. A neighbourhood or landmark is usually not placed at all. (Corrected 2026-10-10: this entry first said a near search carries no distance.) And a street address sent as near on POST /v1/carts is read as the store's own address, so sending the person's home address there builds at whichever branch matches it, which may not be the nearest.

What to do

  • Ask for location permission and send the device's coordinates as lat and lng to GET /v1/places.
  • Without permission, ask for a street address, turn it into coordinates with your platform's geocoder, and send those.
  • Use a city name only when you have nothing better, and let the person choose from the results. Turn a ZIP code or neighbourhood into coordinates first.
  • Build with the placeId of the store the person picks.

Breaking changes

None. No endpoint or field changed.

All changes