selectDiscountsSum$(): Observable<FullPrice>¶
The selectDiscountsSum$
method allows to select a sum of all discounts in the basket.
Returned value¶
A returned value has a type of Observable<FullPrice> representing a sum of all discounts.
Example¶
In this example we make a basketPromotionsApi
call to select a sum of all discounts in the basket.
useStorefront(async (storefront) => {
let basketPromotionsApi = storefront.getApiSync('basketPromotionsApi');
if (!basketPromotionsApi) {
const featureSystemApi = this.getApiSync('FeatureSystemApi');
await featureSystemApi.registerDynamic('basket');
basketPromotionsApi = storefront.getApiSync('basketPromotionsApi');
}
const discountsSum$ = basketPromotionsApi.selectDiscountsSum$();
});
Basket Promotions API methods reference¶
- add
- remove
- get
- select$
- getDiscountsSum
- getHasPromotionCode
- selectHasPromotionCode$
- getPromotionCode
- selectPromotionCode$