Skip to content

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 ({ eventBus, getApi }) => {
    eventBus.on('basket.initialized', async () => {
        const basketPromotionsApi = await getApi('basketPromotionsApi');

        const discountsSum$ = basketPromotionsApi.selectDiscountsSum$();
    });
});

Basket Promotions API methods reference

Models reference