Skip to content

getSectionValidation(): TSectionValidation

The getSectionValidation method allows to validate a section containing additional fields and check for potential errors.

Returned value

A returned value has a type of TSectionValidation representing an object that tells whether a section was successfully validated or not.

Example

In this example we make a basketAdditionalFieldsApi call to validate the basket section with additional fields.

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

Basket Additional Fields API methods reference

Objects reference