Skip to content

getSum(): FullPrice

The getSum method allows to retrieve information about a total sum of products in the current basket.

Returned value

A returned value has a type of FullPrice which represents a FullPrice model.

Example

In this example we make a basketOverallApi call to retrieve a total sum of products in the basket.

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

        const sum = basketOverallApi.getSum();

        console.log('current sum:', sum.grossValueFormatted);
    });
});

Basket Overall API methods reference

Models reference