Home > widget-integration > CartDrawerRecommendationController > refetchAndRenderRecommendations
CartDrawerRecommendationController.refetchAndRenderRecommendations() method
Re-fetch recommendation data and re-render the widget. Called when all products have been hidden after add-to-cart actions.
Signature:
protected refetchAndRenderRecommendations(): Promise<void>;
Returns:
Promise<void>
Remarks
This method adds a loading state class to the container during the fetch, and hides the entire widget if no more recommendations are available.
Example
Override to add custom behavior when recommendations are refreshed:
protected async refetchAndRenderRecommendations() {
// Show a custom loading indicator
this.showCustomLoader();
await super.refetchAndRenderRecommendations();
this.hideCustomLoader();
}