Skip to content

getHasItemsPaidInLoyaltyPoints(): boolean

The getHasItemsPaidInLoyaltyPoints method allows to retrieve whether items paid for using loyalty points are present in the current basket or not.

Returned value

A returned value has a type of boolean. If a current basket contains items paid for using loyalty points, it returns true. Otherwise it returns false.

Example

In this example we make a basketLoyaltyApi call to retrieve whether items paid for using loyalty points are present in the current basket or not.

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

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

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

    const hasItemsPaidInLoyaltyPoints = basketLoyaltyApi.getHasItemsPaidInLoyaltyPoints();

    if (hasItemsPaidInLoyaltyPoints) {
        console.log('There are some products exchanged with loyalty points');
    }
    else {
        console.log('Products exchanged with loyalty points not found');
    }
});

Basket Loyalty API methods reference