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 ({ eventBus, getApi }) => {
eventBus.on('basket.initialized', async () => {
const basketPromotionsApi = await getApi('basketPromotionsApi');
const discountsSum = basketPromotionsApi.getDiscountsSum();
});
});
Basket Promotions API methods reference¶
- add
- remove
- get
- select$
- selectDiscountsSum$
- getHasPromotionCode
- selectHasPromotionCode$
- getPromotionCode
- selectPromotionCode$