basket.initialized¶
basket.initialized
is an event on the Event Bus that occurs when a basket has been initialized.
Event body¶
none
Example¶
In this example we listen to basket.initialized
event and perform an action whenever it's emitted.
useStorefront(async (storefront) => {
storefront.eventBus.on('basket.initialized', ({ body: basket }) => {
console.log('Basket has been initialized!');
});
});
Example¶
In this example we retrieve one of Basket APIs - Basket Promotions API after basket.initialized
event has occured.
useStorefront(async ({ eventBus, getApi }) => {
eventBus.on('basket.initialized', async () => {
const basketPromotionsApi = await getApi('basketPromotionsApi');
});
});