select$(): Observable<Discount[]>¶
The select$
method allows to select a list of active discounts in the basket.
Returned value¶
A returned value has a type of Observable<Discount[]> representing a list of active discounts.
Example¶
In this example we make a basketPromotionsApi
call to select a list of active discounts in the basket
useStorefront(async ({ eventBus, getApi }) => {
eventBus.on('basket.initialized', async () => {
const basketPromotionsApi = await getApi('basketPromotionsApi');
const discountsList$ = basketPromotionsApi.select$();
});
});
Basket Promotions API methods reference¶
- add
- remove
- get
- getDiscountsSum
- selectDiscountsSum$
- getHasPromotionCode
- selectHasPromotionCode$
- getPromotionCode
- selectPromotionCode$