selectLoyaltyPointsAwarded$(): Observable<LoyaltyPoints | null>¶
The selectLoyaltyPointsAwarded$
method allows to select the amount of loyalty points awarded for a current order.
Returned value¶
A returned value has a type of Observable<LoyaltyPoints | null>
where LoyaltyPoints represents a model of loyalty points.
Example¶
In this example we make a basketLoyaltyApi
call to select 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.selectLoyaltyPointsAwarded$();
loyaltyPointsAwarded$.subscribe((loyaltyPoints) => {
console.log('The amount of awarded points: ', loyaltyPoints);
});
});
Basket Loyalty API methods reference¶
- getLoyaltyPointsAwarded
- selectHasItemsPaidInLoyaltyPoints$
- getHasItemsPaidInLoyaltyPoints
- selectLoyaltyPointsCost$
- getLoyaltyPointsCost
- selectLoyaltyPointsExchangePrice$
- getLoyaltyPointsExchangePrice