getSum(): FullPrice¶
The getSum
method allows to retrieve a sum of all products in the basket before 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 before 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 sum = this._basketProductsApi.getSum();
});
Basket Products API methods reference¶
- get
- select$
- remove
- update
- getBasketCount
- selectBasketCount$
- getBasketPositions
- selectBasketPositions$
- getSum
- selectSum$
- getDiscountedSum
- selectDiscountedSum$
- getSectionValidation
- selectSectionValidation$