Skip to content

getId(): string

The getId method allows to retrieve an id of a current basket.

Returned value

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

Example

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

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

    const basketId = basketOverallApi.getId();

    console.log('current basket id:'. basketId);
});

Basket Overall API methods reference