Skip to content

setComment(comment: string): Promise<void>

The setComment is an asynchronous method that allows to set a comment to order in the current basket.

Input parameters

comment

comment is a mandatory parameter of the string type that represents the comment that we want to set as a current comment to the order.

Returned value

A returned value has a type of Promise<void> as this method returns nothing.

Example

In this example we make a basketOverallApi call to set a comment to the order.

useStorefront(async ({ eventBus, getApi }) => {
    eventBus.on('basket.initialized', async () => {
        const basketOverallApi = await getApi('basketOverallApi');

        await basketOverallApi.setComment('Please make sure to draw a kitten on the box');
    });
});

Basket Overall API methods reference