Skip to content

isEveryAvailablePaymentFree(): boolean

The isEveryAvailablePaymentFree method allows to check if every available payment option is free.

Returned value

A returned value has a type of boolean. If every available payment option is free it's true. Otherwise it's false.

Example

In this example we make a basketShippingsApi call to check if every available payment option is free.

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

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

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

    const isEveryAvailablePaymentFree = basketShippingsApi.isEveryAvailablePaymentFree();

    if (isEveryAvailablePaymentFree) {
        // do something
    }
});

Basket Address API methods reference