Skip to content

selectSum$(): Observable<FullPrice>

The selectSum$ method allows to select information about a total sum of products in the current basket.

Returned value

A returned value has a type of Observable<FullPrice> where FullPrice represents a FullPrice model.

Example

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

useStorefront(async (storefront) => {
    const basketOverallApi = storefront.getApiSync('basketOverallApi');

    const sum$ = basketOverallApi.selectSum$();

    sum$.subscribe((sum) => {
        console.log('current sum:'. sum.grossValueFormatted);
    });
});

Basket Overall API methods reference

Models reference