Skip to content

getProductsOfTheDay(options?: TGetProductsOptions): Promise<TWebapiList<Product> | null>

The getProductsOfTheDay is an asynchronous method that allows to fetch a list of products of the day.

Input parameters

options - an optional object with additional options for the request. You can read more about TGetProductsOptions object here.

Returned value

A returned value has a type of Promise<TWebapiList<Product> | null>. You can read more about TWebapiList object here.

Example

In this example we make a ProductFetcherApi call to get products of the day.

useStorefront(async (storefront) => {
    let productFetcherApi = await storefront.getApi('ProductFetcherApi');

    if (!productFetcherApi) {
        const featureSystemApi = storefront.getApiSync('FeatureSystemApi');
        await featureSystemApi.registerDynamic('ProductFetcher');

        productFetcherApi = await storefront.getApi('ProductFetcherApi');
    }

    const products = await productFetcherApi.getProductsOfTheDay();
    console.log(products);
});

Product Fetcher API methods reference

Objects reference