Skip to content

selectId$(): Observable<string>

The selectId$ method allows to select an id of a current basket.

Returned value

A returned value has a type of Observable<string> representing a current basket id.

Example

In this example we make a basketOverallApi call to select a current basket id.

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

    const basketId$ = basketOverallApi.selectId$();

    basketId$.subscribe((basketId) => {
        console.log('current basket id:'. basketId);
    });
});

Basket Overall API methods reference