Skip to content

selectSectionValidation$(): Observable<TSectionValidation>

The selectSectionValidation$ method allows you to observe the validation state of the shipping section of the basket.

Returned value

A returned value has a type of Observable<TSectionValidation> where TSectionValidation represents the TSectionValidation model.

Example

In this example, we make a basketShippingsApi call to observe the validation state of the shipping section of the basket.

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

        const sectionValidation$ = basketShippingsApi.selectSectionValidation$();

        sectionValidation$.subscribe((validationState) => {
            console.log('Shipping section validation state:', validationState);
        });
    });
});

Basket Address API methods reference

Objects reference