Skip to content

getSectionValidation(): TSectionValidation

The getSectionValidation method validates the payment section of the basket's shipping configuration, ensuring that all payment-related information meets the required validation rules.

Returned value

A returned value has a type of TSectionValidation, which contains validation results and statuses for the payment section.

Example

In this example, we use the basketShippingsApi to validate the payment section of the basket's shipping configuration.

useStorefront(async (storefront) => {
    let basketShippingsApi = storefront.getApiSync('basketShippingsApi');

    if (!basketShippingsApi) {
        const featureSystemApi = this.getApiSync('FeatureSystemApi');
        await featureSystemApi.registerDynamic('basket');

        basketShippingsApi = storefront.getApiSync('basketShippingsApi');
    }

    const validationResults = basketShippingsApi.getSectionValidation();

    console.log('Payment section validation:', validationResults);
});

Basket Shippings API methods reference

Objects reference