Skip to content

getDiscountedSum(): FullPrice

The getDiscountedSum method allows to retrieve a sum of all products in the basket after applying all discounts and promotions.

Returned value

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

Example

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

useStorefront(async ({ eventBus, getApi }) => {
    eventBus.on('basket.initialized', async () => {
        const basketProductsApi = await getApi('basketProductsApi');

        const discountedSum = basketProductsApi.getDiscountedSum();
    });
});

Basket Products API methods reference

Models reference