getInvalidSections(): TBasketInvalidSections¶
The getInvalidSections
method allows to retrieve the incorrectly filled sections of the current basket.
Returned value¶
A returned value has a type of TBasketInvalidSections
which represents the TBasketInvalidSections object.
Example¶
In this example we make a basketOverallApi
call to retrieve the incorrectly filled sections of the current basket
useStorefront(async (storefront) => {
const basketOverallApi = storefront.getApiSync('basketOverallApi');
const basketInvalidSections = basketOverallApi.getInvalidSections();
console.log('currently invalid fields:')
Object.entries(basketInvalidSections).forEach(([section, validationError]) => {
if (!validationError) return;
console.log(`${section}: ${validationError}`);
});
});
Basket Overall API methods reference¶
- getActions
- selectActions$
- getId
- selectId$
- getComment
- selectComment$
- getIsVatEu
- selectIsVatEu$
- getDelivery
- selectDelivery$
- getSum
- selectSum$
- getSumWithoutPaymentAndShipping
- selectSumWithoutPaymentAndShipping$
- cleanBasket
- setComment
- selectInvalidSections$
- getSectionValidation
- selectSectionValidation$