> 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: updateLoyaltyProgram(loyaltyProgram: LoyaltyProgram) # Method package: wixLoyaltyV2 # Method menu location: wixLoyaltyV2 --> programs --> updateLoyaltyProgram # Method Link: https://dev.wix.com/docs/velo/apis/wix-loyalty-v2/programs/update-loyalty-program.md # Method Description: Updates a site's loyalty program. This method updates the name of the loyalty program and the details of the collectible points unit. To activate the loyalty program, call Activate Loyalty Program. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Update the loyalty program name and the name of its points (dashboard page code) ```javascript import { programs } from 'wix-loyalty.v2'; /* Sample loyaltyProgram object: * { * name: 'Flower Power Program', * pointDefinition: { * customName: 'Petals' * } * } */ export async function myUpdateLoyaltyProgramFunction(loyaltyProgram) { const elevatedUpdateProgram = wixAuth.elevate(programs.updatedLoyaltyProgram) try { const updatedLoyaltyProgram = await elevatedUpdateProgram(loyaltyProgram); const newName = updatedLoyaltyProgram.loyaltyProgram.name; const newPointsName = updatedLoyaltyProgram.loyaltyProgram.pointDefinition.customName; console.log('Success! The names of your loyalty program and its points are now: ', newName, newPointsName); return updatedLoyaltyProgram; } catch (error) { console.error(error); } } /* Promise resolves to: * { * "loyaltyProgram": { * "name": "Flower Power Program", * "pointDefinition": { * "customName": "Petals", * "icon": "shapes/8de38e8fe76f4e9f937ae23e9ba1eb04.svg" * }, * "status": "ACTIVE", * "_createdDate": "2022-11-07T15:26:12.798Z", * "_updatedDate": "2022-11-09T10:07:08.601Z" * } * } */ ``` ## Update the loyalty program name and the name of its points (export from backend code) ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { programs } from 'wix-loyalty.v2'; import { elevate } from 'wix-auth'; /* Sample loyaltyProgram object: * * { * "loyaltyProgram": { * "name": "My Updated Loyalty Program", * "pointDefinition": { * "customName": "Super Points" * }, * "status": "ACTIVE", * "pointsExpiration": { * "status": "DISABLED", * "monthsOfInactivity": 5, * "expiringPointsPercentage": 100 * }, * "premiumFeatures": { * "loyaltyProgram": true, * "tiers": true, * "pointsExpiration": true * } * } * } */ export const myUpdateLoyaltyProgramFunction = webMethod( Permissions.Anyone, async (loyaltyProgram) => { const elevatedUpdateProgram = elevate(programs.updateLoyaltyProgram); try { const updatedLoyaltyProgram = await elevatedUpdateProgram(loyaltyProgram); const newName = updatedLoyaltyProgram.loyaltyProgram.name; const newPointsName = updatedLoyaltyProgram.loyaltyProgram.pointDefinition.customName; console.log( "Success! The names of your loyalty program and its points are now: ", newName, newPointsName, ); return updatedLoyaltyProgram; } catch (error) { console.error(error); } }, ); /* Promise resolves to: * * { * "loyaltyProgram": { * "_createdDate": "2024-06-05T20:31:49.155Z", * "_updatedDate": "2024-06-11T10:28:04.112Z", * "name": "My Updated Loyalty Program", * "pointDefinition": { * "customName": "Super Points", * "icon": "shapes/8de7ee72dcd944caa60f9e226d900f1d.svg" * }, * "pointsExpiration": { * "status": "ENABLED", * "monthsOfInactivity": 5, * "expiringPointsPercentage": 100 * }, * "premiumFeatures": { * "loyaltyProgram": true, * "tiers": true, * "pointsExpiration": true * }, * "status": "ACTIVE" * } * } */ ``` ---