Search.../

listTiers( )

Developer Preview

Retrieves a list of a site's tiers.

Description

To retrieve a specific tier, use getTier().

Syntax

function listTiers(): Promise<ListTiersResponse>

listTiers Parameters

This function does not take any parameters.

Returns

Return Type:

Promise<
ListTiersResponse
>
NAME
TYPE
DESCRIPTION
tiers
Array<
Tier
>

Retrieved loyalty tiers.

Was this helpful?

Get a list of loyalty tiers

Copy Code
1import { tier } from 'wix-loyalty-backend';
2
3export async function myListTiersFunction() {
4 try {
5 const tiersList = await tier.listTiers();
6
7 const firstTierId = tiersList.tiers[0]._id;
8 const firstTierPointsRequired = tiersList.tiers[0].requiredPoints;
9
10 console.log('Success! First tier ID: ', firstTierId, ' requires ', firstTierPointsRequired, ' points.');
11 return tiersList;
12 } catch (error) {
13 console.error(error);
14 }
15}