Skip to content

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 (storefront) => {
    let basketPromotionsApi = storefront.getApiSync('basketPromotionsApi');

    if (!basketPromotionsApi) {
        const featureSystemApi = this.getApiSync('FeatureSystemApi');
        await featureSystemApi.registerDynamic('basket');

        basketPromotionsApi = storefront.getApiSync('basketPromotionsApi');
    }

    const discountsList$ = basketPromotionsApi.select$();
});

Basket Promotions API methods reference

Models reference