Skip to content

getLoyaltyPointsAwarded(): LoyaltyPoints

The getLoyaltyPointsAwarded method allows to retrieve the amount of loyalty points awarded for a current order.

Returned value

A returned value has a type of LoyaltyPoints which represents a model of loyalty points.

Example

In this example we make a basketLoyaltyApi call to retrieve the amount of awarded loyalty 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 loyaltyPointsAwarded = basketLoyaltyApi.getLoyaltyPointsAwarded();

    console.log('The amount of awarded points: ', loyaltyPointsAwarded);
});

Basket Loyalty API methods reference

Models reference