> 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: createTier(tier: Tier) # Method package: wixLoyaltyV2 # Method menu location: wixLoyaltyV2 --> tiers --> createTier # Method Link: https://dev.wix.com/docs/velo/apis/wix-loyalty-v2/tiers/create-tier.md # Method Description: Creates a tier. The name for a tier and the amount of required points to qualify for a tier can only exist for a single tier. Attempts to create a tier with a `tierDefinition.name` or `requiredPoints` that already exist return an error. To create up to 20 tiers at once, call Bulk Create Tiers. >**Note:** A site must have a [Plus plan](https://support.wix.com/en/article/wix-studio-upgrading-sites) (Wix Studio) >or a [Business plan](https://support.wix.com/en/article/choosing-a-premium-plan?tabs=Business) (Wix Editor) to add tiers. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Create a new tier (export from backend code) ```javascript import { tiers } from "wix-loyalty.v2"; import { webMethod, Permissions } from "wix-web-module"; import { elevate } from "wix-auth"; /* Sample tier value: * { * "tier": { * "required_points": 1000, * "tierDefinition": { * "name": "Jadeite Tier", * "description": "Jadeite Tier Benefits", * "icon": { * "url": "shapes/cca51dde12d348379113f2201cbe4e6c.svg" * } * } * } * } */ const elevatedCreateTier = elevate(tiers.createTier); export const createTier = webMethod( Permissions.Anyone, async (tier) => { try { const result = await elevatedCreateTier(tier); return result; } catch (error) { console.error(error); // Handle the error } }); /* Promise resolves to: * { * "tier": { * "_createdDate": "2024-06-11T12:38:35.490Z", * "_id": "8edeea05-2c90-43fa-bd15-b2352620fd51", * "_updatedDate": "2024-06-11T12:38:35.490Z", * "requiredPoints": 1000, * "revision": "1", * "tierDefinition": { * "description": "Jadeite Tier Benefits", * "icon": { * "id": "", * "url": "shapes/cca51dde12d348379113f2201cbe4e6c.svg", * "height": 0, * "width": 0, * "altText": null, * "urlExpirationDate": null, * "filename": null, * "sizeInBytes": null * }, * "name": "Jadeite Tier" * } * } * } */ ``` ## Create tier (dashboard page code) ```javascript import { tiers } from "wix-loyalty.v2"; /* Sample tier value: * { * "tier": { * "required_points": 1000, * "tierDefinition": { * "name": "Jadeite Tier", * "description": "Jadeite Tier Benefits", * "icon": { * "url": "shapes/cca51dde12d348379113f2201cbe4e6c.svg" * } * } * } * } */ async function createTier(tier) { try { const result = await tiers.createTier(tier); return result; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "tier": { * "_createdDate": "2024-06-11T12:38:35.490Z", * "_id": "8edeea05-2c90-43fa-bd15-b2352620fd51", * "_updatedDate": "2024-06-11T12:38:35.490Z", * "requiredPoints": 1000, * "revision": "1", * "tierDefinition": { * "description": "Jadeite Tier Benefits", * "icon": { * "id": "", * "url": "shapes/cca51dde12d348379113f2201cbe4e6c.svg", * "height": 0, * "width": 0, * "altText": null, * "urlExpirationDate": null, * "filename": null, * "sizeInBytes": null * }, * "name": "Jadeite Tier" * } * } * } */ ``` ---