Home > widget-integration > RecommendationService > getRecommendationWidgetProducts
RecommendationService.getRecommendationWidgetProducts() method
Fetches recommendation products for a widget from the API.
Builds request parameters from widget configuration and makes API call to retrieve recommended products. Handles different recommendation types and includes necessary context (customer ID, collection ID, locale, product IDs).
Signature:
getRecommendationWidgetProducts(widgetId: string): Promise<Product[]>;
Parameters
| 
 Parameter  | 
 Type  | 
 Description  | 
|---|---|---|
| 
 widgetId  | 
 string  | 
 The widget identifier used to determine configuration and request parameters  | 
Returns:
Promise<Product[]>
Promise resolving to array of recommended products in Boost format. Returns empty array if no products are found, API call fails, or product IDs are required but unavailable for the recommendation type.
Example
Fetch products for a widget:
const products = await this.getRecommendationWidgetProducts('homepage-recommendations-1');
console.log(`Found ${products.length} recommended products`);