Home > widget-integration > CartDrawerRecommendationService > getWidgetId
CartDrawerRecommendationService.getWidgetId() method
Get the widget ID from cart settings.
Signature:
getWidgetId(): string | null;
Returns:
string | null
Widget ID string (e.g., "cartdrawer-408504") or null if not configured
Example
Override to use a different widget ID per page type:
getWidgetId() {
if (window.location.pathname === '/cart') return 'cart-page-rec-1';
return super.getWidgetId();
}