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 ({ eventBus, getApi }) => {
    eventBus.on('basket.initialized', async () => {
        const basketShippingsApi = await getApi('basketShippingsApi');

        const isEveryAvailablePaymentFree = basketShippingsApi.isEveryAvailablePaymentFree();

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

Basket Address API methods reference