Retrieves locations, given the specified filters, sorting, and paging.
function listLocations(
options: ListLocationsOptions,
): Promise<ListLocationsResponse>;
Options to use when retrieving a list of locations.
import { locations } from "@wix/business-tools";
export async function myGetLocationFunction(_id) {
try {
const myLocations = await locations.getLocation(_id);
console.log("Locations:", myLocations);
return myLocations;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "locations": [
* {
* "_id": "6a7a7356-a122-4de6-943c-3ea9e66f0d0a",
* "address": {
* "city": "Costa Mesa",
* "country": "US",
* "formatted": "Location1980, Placentia Avenue, Costa Mesa, CA, USA",
* "location": {
* "latitude": 33.6463497,
* "longitude": -117.931867
* },
* "postalCode": "92627"
* "streetAddress": {
* "apt": "",
* "name": "Placentia Avenue",
* "number": "1980"
* },
* "subdivision": "CA",
* },
* "archived": false,
* "businessSchedule": {
* "periods": [],
* "specialHourPeriod": []
* },
* "default": true,
* "email": "",
* "fax": "",
* "name": "Costa Mesa Store",
* "phone": "",
* "revision": "1",
* "status": "ACTIVE",
* "timeZone": "America/Los_Angeles"
* },
* {
* "_id": "6a0c5611-0610-4fc2-9eda-a5614ffaf141",
* "address": {
* "city": "Kingston",
* "country": "CA",
* "formatted": "222, Stuart Street, Kingston, ON, Canada",
* "location": {
* "latitude": 44.2236494,
* "longitude": -76.4992216
* },
* "postalCode": "K7L 2W1"
* "streetAddress": {
* "apt": "",
* "name": "Stuart Street",
* "number": "222"
* },
* "subdivision": "ON",
* },
* "archived": false,
* "businessSchedule": {
* "periods": [],
* "specialHourPeriod": []
* },
* "default": false,
* "email": "",
* "fax": "",
* "name": "Kingston Store",
* "phone": "",
* "revision": "1",
* "status": "ACTIVE",
* "timeZone": "America/Los_Angeles"
* }
* ],
* "pagingMetadata": {
* "count": 2,
* "hasNext": false
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.