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