Skip to content

selectComment$(): Observable<string>

The selectComment$ method allows to select the text from Comments to order field.

Returned value

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

Example

In this example we make a basketOverallApi call to select a current comment for the order.

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

        const comment$ = basketOverallApi.selectComment$();

        comment$.subscribe((comment) => {
            console.log('current comment: ', comment);
        });
    });
});

Basket Overall API methods reference