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:
archived
boolean of a location to true
.status
using this endpoint.default
location can't be archived.This function requires elevated permissions and runs only on the backend and on dashboard pages.
function archiveLocation(_id: string): Promise<ArchiveLocationResponse>;
ID of the location to archive.
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",
* }
*/
There is 1 error with this status code.
This method may also return standard errors. Learn more about standard Wix errors.