Skip to content

selectInvalidSections$(): Observable<TBasketInvalidSections>

The selectInvalidSections$ method allows to select the incorrectly filled sections of the current basket.

Returned value

A returned value has a type of Observable<TBasketInvalidSections> where TBasketInvalidSections represents the TBasketInvalidSections object.

Example

In this example we make a basketOverallApi call to select the incorrectly filled sections of the current basket

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

    const invalidSections$ = basketOverallApi.selectInvalidSections$();

    invalidSections$.subscribe((invalidSections) => {
        console.log('currently invalid fields:');

        Object.entries(invalidSections).forEach(([section, validationError]) => {
            if (!validationError) return;

            console.log(`${section}: ${validationError}`);
        });
    });
});

Basket Overall API methods reference

Objects reference