Skip to content

getLoyaltyPointsCost(): LoyaltyPoints | null

The getLoyaltyPointsCost method allows to retrieve the cost of exchanged items in points.

Returned value

A returned value has a type of LoyaltyPoints | null where LoyaltyPoints represents a model of loyalty points.

Example

In this example we make a basketLoyaltyApi call to retrieve the cost of exchanged items in points

useStorefront(async (storefront) => {
    let basketLoyaltyApi = storefront.getApiSync('basketLoyaltyApi');

    if (!basketLoyaltyApi) {
        const featureSystemApi = storefront.getApiSync('FeatureSystemApi');
        await featureSystemApi.registerDynamic('basket');

        basketLoyaltyApi = storefront.getApiSync('basketLoyaltyApi');
    }

    const loyaltyPointsCost = basketLoyaltyApi.getLoyaltyPointsCost();

    console.log('The cost of items exchanged in a loyalty program: ', loyaltyPointsCost);
});

Basket Loyalty API methods reference

Models reference