onLocationUpdated( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Method Declaration
Copy
function wixLocations_onLocationUpdated(event: LocationUpdated): void;
Method Parameters
eventLocationUpdated

Contains information about the updated location and metadata for the event.

An event that triggers when a location is created
JavaScript
// Place this code in the events.js file // of your site's Backend section. // Add the file if it doesn't exist. export function wixLocations_onLocationCreated(event) { const timeOfUpdate = event.metadata.eventTime; const updatedLocationName = event.entity.name; console.log( `${updatedLocationName} was updated at ${timeOfUpdate}. Event details:`, event, ); } /* Full event object: * { * "entity": { * "_id": "6c8ea272-6538-4787-b2e8-9e1e9fb40990", * "address": { * "city": "Barcelona", * "country": "ES", * "formatted": "123 Carrer de Gràcia, Barcelona", * "location": { * "latitude": 41.393349, * "longitude": 2.162154 * }, * "postalCode": "08008", * "streetAddress": { * "apt": "", * "name": "Carrer de Gràcia", * "number": "123" * }, * "subdivision": "ES-CT" * }, * "archived": false, * "businessSchedule": { * "periods": [ * { * "closeDay": "MONDAY", * "closeTime": "18:00", * "openDay": "MONDAY", * "openTime": "08:00" * }, * { * "closeDay": "TUESDAY", * "closeTime": "18:00", * "openDay": "TUESDAY", * "openTime": "08:00" * }, * { * "closeDay": "WEDNESDAY", * "closeTime": "18:00", * "openDay": "WEDNESDAY", * "openTime": "08:00" * }, * { * "closeDay": "THURSDAY", * "closeTime": "18:00", * "openDay": "THURSDAY", * "openTime": "08:00" * }, * { * "closeDay": "FRIDAY", * "closeTime": "18:00", * "openDay": "FRIDAY", * "openTime": "08: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 location in Barcelona City Center!", * "email": "barcelona@example.com", * "fax": "011-34-93-8765432", * "name": "Barcelona City Center Store", * "phone": "011 34 93 876 5432", * "revision": "2", * "status": "ACTIVE", * "timeZone": "Europe/Madrid" * }, * "metadata": { * "entityId": "6c8ea272-6538-4787-b2e8-9e1e9fb40990", * "eventTime": "2023-11-13T09:18:32.050964Z", * "id": "c7f35c35-cdbb-42d2-9bf9-0389d644387e", * "triggeredByAnonymizeRequest": false * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?