setDefaultLocation( )


Sets a new default location.

Notes:

  • There can only be one default location per site.
  • The default location can't be archived.
Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

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

ID of the location to set as the default location.

Returns
Return Type:Promise<SetDefaultLocationResponse>
JavaScript
import { locations } from "@wix/business-tools"; /* Sample _id value: '0a965e36-4071-4df0-905b-75458817430a' */ export async function changeDefaultLocation(_id) { try { const myDefaultLocation = await locations.setDefaultLocation(_id); console.log("Default location has been changed to:", myDefaultLocation); return myDefaultLocation; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * location: { * "_id": "0a965e36-4071-4df0-905b-75458817430a", * "address": { * "streetAddress": { * "apt": "34", * "name": "Musterstraße", * "number": "5" * }, * "city": "Berlin", * "postalCode": "53782" * }, * "archived": false, * "default": true, * "description": "Our brand new store in Germany", * "email": "store@example.com", * "name": "Germany Store", * "phone": "0208 209 9087", * "revision": "2", * "status": "ACTIVE", * "timeZone": "Europe/Berlin" * } * } */
Errors
400Invalid Argument

There are 2 errors with this status code.

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

Did this help?