selectHasItemsPaidInLoyaltyPoints$(): Observable<boolean>¶
The selectHasItemsPaidInLoyaltyPoints$
method allows to select whether items paid for using loyalty points are present in the current basket or not.
Returned value¶
A returned value has a type of Observable<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 select 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.selectHasItemsPaidInLoyaltyPoints$();
hasItemsPaidInLoyaltyPoints$.subscribe((hasItemsPaidInLoyaltyPoints) => {
if (hasItemsPaidInLoyaltyPoints) {
console.log('There are some products exchanged with loyalty points');
}
else {
console.log('Products exchanged with loyalty points not found');
}
});
});