archiveLocation( )


Developer Preview

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

Archives a location.

Notes:

  • Changes the archived boolean of a location to true.
  • You can't change a location's status using this endpoint.
  • Archived locations can't be updated.
  • Currently, it isn't possible to unarchive locations.
  • The default location can't be archived.
Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Locations
Learn more about app permissions.
Method Declaration
Copy
function archiveLocation(_id: string): Promise<ArchiveLocationResponse>;
Method Parameters
_idstringRequired

ID of the location to archive.

Returns
Return Type:Promise<ArchiveLocationResponse>
JavaScript
import { locations } from "wix-business-tools.v2"; import { elevate } from "wix-auth"; /* Sample _id value: '0a965e36-4071-4df0-905b-75458817430a' */ export async function myArchiveLocationFunction(_id) { try { const elevatedArchiveLocation = elevate(locations.archiveLocation); const archivedLocation = await elevatedArchiveLocation(_id); console.log("Location has been archived:", archivedLocation); return archivedLocation; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "_id": "0a965e36-4071-4df0-905b-75458817430a" * "address": { * "streetAddress": { * "apt": "", * "name": "New Road", * "number": "12" * }, * "city": "Kolkata", * "postalCode": "70027" * }, * "archived": true, * "default": false, * "description": "New store in India!", * "email": "store@example.com", * "name": "India Store", * "phone": "0208 209 9087", * "revision": "2", * "status": "ACTIVE", * "timeZone": "Asia/Calcutta", * } */
Errors
400Invalid Argument

There is 1 error with this status code.

This method may also return standard errors. Learn more about standard Wix errors.

Did this help?