getDiscountsSum(): FullPrice¶
The getDiscountsSum
method allows to retrieve a sum of all discounts in the basket.
Returned value¶
A returned value has a type of FullPrice representing a sum of all discounts.
Example¶
In this example we make a basketPromotionsApi
call to retrieve 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.getDiscountsSum();
});
Basket Promotions API methods reference¶
- add
- remove
- get
- select$
- selectDiscountsSum$
- getHasPromotionCode
- selectHasPromotionCode$
- getPromotionCode
- selectPromotionCode$