> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: setDefaultLocation(_id: string) # Method package: wixBusinessToolsV2 # Method menu location: wixBusinessToolsV2 --> locations --> setDefaultLocation # Method Link: https://dev.wix.com/docs/velo/apis/wix-business-tools-v2/locations/set-default-location.md # Method Description: Sets a new default location. > **Notes:** > + There can only be one default location per site. > + The default location can't be archived. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Set the default location (dashboard page code) ```javascript import { locations } from 'wix-business-tools.v2'; import { elevate } from 'wix-auth'; /* Sample _id value: '0a965e36-4071-4df0-905b-75458817430a' */ export async function changeDefaultLocation(_id) { try { const elevatedSetDefaultLocation = elevate(locations.setDefaultLocation); const myDefaultLocation = await elevatedSetDefaultLocation(_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" * } * } */ ``` ## Set the default location (export from backend code) ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { locations } from 'wix-business-tools.v2'; import { elevate } from 'wix-auth'; /* Sample _id value: '0a965e36-4071-4df0-905b-75458817430a' */ export const changeDefaultLocation = webMethod(Permissions.Anyone, async (_id) => { try { const elevatedSetDefaultLocation = elevate(locations.setDefaultLocation); const myDefaultLocation = await elevatedSetDefaultLocation(_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" * } * } */ ``` ---