Home > widget-integration > RecommendationWidgetController > loadTemplate
RecommendationWidgetController.loadTemplate() method
Loads the widget template from the recommendation service.
Override this method to customize template loading logic, such as loading shop-specific templates, adding template preprocessing, or implementing template caching strategies.
Signature:
protected loadTemplate(): Promise<string>;
Returns:
Promise<string>
Promise resolving to the widget template HTML string
Exceptions
{Error} When template fetching fails or returns invalid data
Example
Override to use custom template for specific shop:
protected async loadTemplate() {
  // Check if shop has custom template
  const customTemplate = await this.fetchCustomTemplate();
  if (customTemplate) {
    return customTemplate;
  }
  return super.loadTemplate();
}