get(): ProductBasket[]¶
The get
method allows to retrieve a list of items inside the basket.
Returned value¶
A returned value has a type of ProductBasket[] representing a list of products inside the basket.
Example¶
In this example we make a basketProductsApi
call to retrieve a list of items inside the basket.
useStorefront(async (storefront) => {
let basketProductsApi = storefront.getApiSync('basketProductsApi');
if (!basketProductsApi) {
const featureSystemApi = this.getApiSync('FeatureSystemApi');
await featureSystemApi.registerDynamic('basket');
basketProductsApi = storefront.getApiSync('basketProductsApi');
}
const productsInBasket = basketProductsApi.get();
});
Basket Products API methods reference¶
- select$
- remove
- update
- getBasketCount
- selectBasketCount$
- getBasketPositions
- selectBasketPositions$
- getSum
- selectSum$
- getDiscountedSum
- selectDiscountedSum$
- getSectionValidation
- selectSectionValidation$