Skip to content

getLoyaltyPoints(): number | null

The getLoyaltyPoints method allows you to get the amount of points in the loyalty program for a currently authenticated user.

Returned value

A returned value has a type of number | null representing the amount of points. null will be returned if the loyalty program is not active.

Example

In this example we make a UserApi call to get the points in the loyalty program.

    useStorefront(async (storefront) => {
        const userApi = await storefront.getApi('UserApi');

        const loyaltyPoints = userApi.getLoyaltyPoints();

        console.log('amount of loyalty points:', loyaltyPoints);
    });

User API methods reference