Skip to content

selectDiscountedSum$(): Observable<FullPrice>

The selectDiscountedSum$ method allows to select a sum of all products in the basket after applying all discounts and promotions.

Returned value

A returned value has a type of Observable<FullPrice> representing the sum of all products in the basket.

Example

In this example we make a basketProductsApi call to select a sum of all products in the basket after applying all discounts and promotions.

useStorefront(async (storefront) => {
    let basketProductsApi = storefront.getApiSync('basketProductsApi');

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

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

    const discountedSum$ = this._basketProductsApi.selectDiscountedSum$();
});

Basket Products API methods reference

Models reference