select$(): Observable<ProductBasket[]>¶
The select$
method allows to select a list of items inside the basket.
Returned value¶
A returned value has a type of Observable<ProductBasket[]> representing a list of products inside the basket.
Example¶
In this example we make a basketProductsApi
call to select 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.select$();
});
Basket Products API methods reference¶
- get
- remove
- update
- getBasketCount
- selectBasketCount$
- getBasketPositions
- selectBasketPositions$
- getSum
- selectSum$
- getDiscountedSum
- selectDiscountedSum$
- getSectionValidation
- selectSectionValidation$