Skip to content

get(): Discount[]

The get method allows to retrieve a list of active discounts in the basket.

Returned value

A returned value has a type of Discount[] representing a list of active discounts.

Example

In this example we make a basketPromotionsApi call to retrieve a list of active discounts in the basket.

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

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

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

    const discountsList = basketPromotionsApi.get();
});

Basket Promotions API methods reference

Models reference