> 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: bulkCreateTiers(tiers: Array) # Method package: wixLoyaltyV2 # Method menu location: wixLoyaltyV2 --> tiers --> bulkCreateTiers # Method Link: https://dev.wix.com/docs/velo/apis/wix-loyalty-v2/tiers/bulk-create-tiers.md # Method Description: Creates up to 20 tiers. 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 exists returns an error. To create a single tier, use Create Tier. >**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. ## Bulk create tiers (export from backend code) ```javascript import { tiers } from "wix-loyalty.v2"; import { webMethod, Permissions } from "wix-web-module"; import { elevate } from "wix-auth"; /* Sample tiers object: * * { * "tiers": [ * { * "required_points": 50, * "tierDefinition": { * "name": "Elite Member Tier", * "description": "Exclusive tier for elite members" * } * } * ] * } */ const elevatedBulkCreateTiers = elevate(tiers.bulkCreateTiers); export const bulkCreateTiers = webMethod( Permissions.Anyone, async (tiers) => { try { const result = await elevatedBulkCreateTiers(tiers); return result; } catch (error) { console.error(error); // Handle the error } }); /* Promise resolves to: * * { * "bulkActionMetadata": { * "totalFailures": 0, * "totalSuccesses": 1, * "undetailedFailures": 0 * }, * "results": [ * { * "item": { * "tierDefinition": { * "name": "Elite Member Tier", * "description": "Exclusive tier for elite members" * }, * "_createdDate": "2024-06-10T07:09:04.213Z", * "_id": "dd43f55d-6d6f-45eb-b76e-13a161a436a1", * "_updatedDate": "2024-06-10T07:09:04.213Z", * "requiredPoints": 50, * "revision": "1" * }, * "itemMetadata": { * "_id": "dd43f55d-6d6f-45eb-b76e-13a161a436a1", * "originalIndex": 0, * "success": true * } * } * ] * } */ ``` ## Bulk create tiers (dashboard page code) @description: ```javascript import { tiers } from "wix-loyalty.v2"; /* Sample tiers object: * * { * "tiers": [ * { * "required_points": 50, * "tierDefinition": { * "name": "Elite Member Tier", * "description": "Exclusive tier for elite members" * } * } * ] * } */ async function bulkCreateTiers(tiers) { try { const result = await tiers.bulkCreateTiers(tiers); return result; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * * { * "bulkActionMetadata": { * "totalFailures": 0, * "totalSuccesses": 1, * "undetailedFailures": 0 * }, * "results": [ * { * "item": { * "tierDefinition": { * "name": "Elite Member Tier", * "description": "Exclusive tier for elite members" * }, * "_createdDate": "2024-06-10T07:09:04.213Z", * "_id": "dd43f55d-6d6f-45eb-b76e-13a161a436a1", * "_updatedDate": "2024-06-10T07:09:04.213Z", * "requiredPoints": 50, * "revision": "1" * }, * "itemMetadata": { * "_id": "dd43f55d-6d6f-45eb-b76e-13a161a436a1", * "originalIndex": 0, * "success": true * } * } * ] * } */ ``` ---