> 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 # UpdateTier # Package: loyaltyProgramManagement # Namespace: LoyaltyTiers # Method link: https://dev.wix.com/docs/api-reference/crm/loyalty-program/loyalty-program-management/tiers/update-tier.md ## Permission Scopes: Manage Loyalty: SCOPE.DC-LOYALTY.MANAGE-LOYALTY ## Introduction Updates a loyalty tier. Call this method to update tier-specific settings, such as the name and the required points threshold of an individual loyalty tier. To update global settings that apply to all of a site's loyalty tiers, call Update Tiers Program Settings. --- ## REST API ### Schema ``` Method: updateTier Description: Updates a loyalty tier. Call this method to update tier-specific settings, such as the name and the required points threshold of an individual loyalty tier. To update global settings that apply to all of a site's loyalty tiers, call Update Tiers Program Settings. URL: https://www.wixapis.com/v1/tiers/{tier.id} Method: PATCH # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: tier, tier.id, tier.revision Method parameters: param name: tier | type: Tier | description: A tier is a loyalty level that customers are assigned to based on the amount of points they earn. Read more [about loyalty tiers](https://support.wix.com/en/article/about-tiers). | required: true - name: id | type: string | description: Tier GUID. | required: true - name: tierDefinition | type: TierDefinition | description: Information about the tier. - name: icon | type: Image | description: Details about the tier icon. - name: id | type: string | description: WixMedia image GUID. - name: url | type: string | description: Image URL. - name: altText | type: string | description: Image alt text. - name: name | type: string | description: Tier name. - name: description | type: string | description: Tier description. - name: requiredPoints | type: integer | description: The amount of points required to be in this tier. - name: revision | type: string | description: Revision number, which increments by 1 each time the loyalty tier is updated. To prevent conflicting changes, the current `revision` must be passed when updating the loyalty tier. | required: true Return type: UpdateTierResponse - name: tier | type: Tier | description: Updated loyalty tier. - name: id | type: string | description: Tier GUID. - name: tierDefinition | type: TierDefinition | description: Information about the tier. - name: icon | type: Image | description: Details about the tier icon. - name: id | type: string | description: WixMedia image GUID. - name: url | type: string | description: Image URL. - name: height | type: integer | description: Original image height. - name: width | type: integer | description: Original image width. - name: altText | type: string | description: Image alt text. - name: filename | type: string | description: Image filename. - name: name | type: string | description: Tier name. - name: description | type: string | description: Tier description. - name: requiredPoints | type: integer | description: The amount of points required to be in this tier. - name: revision | type: string | description: Revision number, which increments by 1 each time the loyalty tier is updated. To prevent conflicting changes, the current `revision` must be passed when updating the loyalty tier. - name: createdDate | type: string | description: Date and time the tier was created. - name: updatedDate | type: string | description: Date and time the tier was last updated. ``` ### Examples ### Update tier ```curl curl -X PATCH \ 'https://www.wixapis.com/loyalty-tiers/v1/tiers/acddc0e0-5e27-4a1b-a52d-b3785ac258cb' \ -H 'Authorization: ' -H 'Content-Type: application/json' \ --data-raw '{ "tier": { "tierDefinition": { "name": "Gold", "description": "Earn 2x points and get special discount", "icon": { "url": "shapes/39dce0a5d1ce498f95526b1390eaf585.svg" } }, "requiredPoints": 400 } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.loyaltyProgramManagement.LoyaltyTiers.updateTier(_id, tier) Description: Updates a loyalty tier. Call this method to update tier-specific settings, such as the name and the required points threshold of an individual loyalty tier. To update global settings that apply to all of a site's loyalty tiers, call Update Tiers Program Settings. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: tier, _id, tier.revision Method parameters: param name: _id | type: string | description: Tier GUID. | required: true param name: tier | type: Tier | description: A tier is a loyalty level that customers are assigned to based on the amount of points they earn. Read more [about loyalty tiers](https://support.wix.com/en/article/about-tiers). | required: true - name: tierDefinition | type: TierDefinition | description: Information about the tier. - name: icon | type: string | description: Details about the tier icon. - name: name | type: string | description: Tier name. - name: description | type: string | description: Tier description. - name: requiredPoints | type: integer | description: The amount of points required to be in this tier. - name: revision | type: string | description: Revision number, which increments by 1 each time the loyalty tier is updated. To prevent conflicting changes, the current `revision` must be passed when updating the loyalty tier. | required: true Return type: PROMISE - name: _id | type: string | description: Tier GUID. - name: tierDefinition | type: TierDefinition | description: Information about the tier. - name: icon | type: string | description: Details about the tier icon. - name: name | type: string | description: Tier name. - name: description | type: string | description: Tier description. - name: requiredPoints | type: integer | description: The amount of points required to be in this tier. - name: revision | type: string | description: Revision number, which increments by 1 each time the loyalty tier is updated. To prevent conflicting changes, the current `revision` must be passed when updating the loyalty tier. - name: _createdDate | type: Date | description: Date and time the tier was created. - name: _updatedDate | type: Date | description: Date and time the tier was last updated. ``` ### Examples ### Update tier (with elevated permissions) ```javascript import { tiers } from "@wix/loyalty"; import { auth } from "@wix/essentials"; /* Sample parameter values: * * { * "tier": { * "_id": "7e26e41b-3bb6-40c9-bb7e-855b9f4f69e2", * "required_points": 80, * "tierDefinition": { * "name": "Updated Tier", * "description": "Updated tier name" * } * } * } */ const elevatedUpdateTier = auth.elevate(tiers.updateTier); async function updateTier(id, tier) { try { const result = await elevatedUpdateTier(id, tier); return result; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "_createdDate": "2024-06-06T10:33:19.121Z", * "_id": "7e26e41b-3bb6-40c9-bb7e-855b9f4f69e2", * "_updatedDate": "2024-06-10T12:48:59.740Z", * "requiredPoints": 80, * "revision": "3", * "tierDefinition": { * "name": "Updated Tier", * "description": "Updated tier name" * } * } */ ``` ### Update tier ```javascript import { tiers } from "@wix/loyalty"; /* Sample parameter values: * * { * "tier": { * "_id": "7e26e41b-3bb6-40c9-bb7e-855b9f4f69e2", * "required_points": 80, * "tierDefinition": { * "name": "Updated Tier", * "description": "Updated tier name" * } * } * } */ async function updateTier(id, tier) { try { const result = await tiers.updateTier(id, tier); return result; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * { * "_createdDate": "2024-06-06T10:33:19.121Z", * "_id": "7e26e41b-3bb6-40c9-bb7e-855b9f4f69e2", * "_updatedDate": "2024-06-10T12:48:59.740Z", * "requiredPoints": 80, * "revision": "3", * "tierDefinition": { * "name": "Updated Tier", * "description": "Updated tier name" * } * } */ ``` ### updateTier (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { tiers } from '@wix/loyalty'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { tiers }, // Include the auth strategy and host as relevant }); async function updateTier(_id,tier) { const response = await myWixClient.tiers.updateTier(_id,tier); }; ``` ---