Commerce includes several classes that manage location information for your stores. The Coordinate
class stores latitude and longitude information. The CoordinateManager
includes methods for determining store locations and their proximity so that customers can select an appropriate location for pick-up. All coordinates are defined using latitude and longitude properties:
getNearest()
– This method takes a pair of coordinates (either as arepositoryItem
or as aCoordinate
object) and a radius in meters and returns all locations within that radius. The results are ordered by distance from the provided coordinatesaddMetersToLongitude()
– This method is used to determine the longitude boundaries of the location queryaddMetersToLatitude()
– This method determines the latitude boundaries of a location querygetDistanceBetweenCoordinates()
– This method returns the distance, in meters, between the two coordinate items
Note: These coordinates are intended for providing local information, and are estimates only.