This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Overrides an existing location.
Note: Currently, it isn't possible to partially update a location. Therefore, you'll need to pass the full location object in the body of the call.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
function updateLocation(
_id: string,
location: UpdateLocation,
): Promise<Location>;
Location ID.
Updated location details.
import { locations } from "wix-business-tools.v2";
import { elevate } from "wix-auth";
/* Sample _id value: '4ae3bbc8-fb78-4eb7-8bc5-1fec19c7dbfc'
*
* Sample location value:
* {
* address: {
* city: 'Roma',
* country: 'IT',
* formatted: 'Via Roma 123, 00100 Roma',
* location: {
* latitude: 41.9028,
* longitude: 12.4964
* },
* postalCode: '00100',
* streetAddress: {
* apt: '',
* name: 'Via Roma',
* number: '123'
* },
* subdivision: 'IT-RM'
* },
* businessSchedule: {
* periods: [
* {
* closeDay: 'SATURDAY',
* closeTime: '24:00',
* openDay: 'MONDAY',
* openTime: '00:00'
* }
* ],
* specialHourPeriod: [
* {
* comment: 'Half price in the lead up to Christmas!',
* endDate: '2023-12-24T23:59:00Z',
* isClosed: false,
* startDate: '2023-12-01T00:00:00Z'
* }
* ]
* },
* description: 'Our store in Rome is open 24/6!',
* email: '24.6.rome@example.com',
* fax: '+39 06 1234 5679',
* name: 'Rome 24/6',
* phone: '+39 06 1234 5678',
* status: 'ACTIVE',
* timeZone: 'Europe/Rome'
* }
*/
export async function myCreateLocationFunction(_id, location) {
try {
const elevatedCreateLocation = elevate(locations.createLocation);
const updatedLocation = await elevatedCreateLocation(_id, location);
console.log(
"Location details have been successfully updated:",
updatedLocation,
);
return updatedLocation;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "_id": "4ae3bbc8-fb78-4eb7-8bc5-1fec19c7dbfc"
* "address": {
* "city": "Roma",
* "country": "IT",
* "formatted": "Via Roma 123, 00100 Roma",
* "location": {
* "latitude": 41.9028,
* "longitude": 12.4964
* },
* "postalCode": "00100",
* "streetAddress": {
* "apt": "",
* "name": "Via Roma",
* "number": "123"
* },
* "subdivision": 'IT-RM'
* },
* "archived": false,
* "businessSchedule": {
* "periods": [
* {
* "closeDay": "MONDAY",
* "closeTime": "00:00",
* "openDay": "SATURDAY",
* "openTime": "24:00"
* }
* ],
* "specialHourPeriod": [
* {
* "comment": "Half price in the lead up to Christmas!",
* "endDate": "2023-12-24T23:59:00Z",
* "isClosed": false,
* "startDate": "2023-12-01T00:00:00Z"
* }
* ]
* },
* "default": false,
* "description": "Our store in Rome is open 24/6!",
* "email": "24.6.rome@example.com",
* "fax": "+39 06 1234 5679",
* "name": "Rome 24/6",
* "phone": "+39 06 1234 5678",
* "revision": "2",
* "status": "ACTIVE",
* "timeZone": "Europe/Rome"
* }
*/
There are 2 errors with this status code.
There is 1 error with this status code.
This method may also return standard errors. Learn more about standard Wix errors.