Home > widget-integration > CartDrawerRecommendationController > shouldInitCarousel

CartDrawerRecommendationController.shouldInitCarousel() method

Determine whether the native carousel should be initialized.

Returns false when the viewport is desktop (> 991px) and the cart is configured with cartStyle: 'side' and sideLayout: 'two-columns'. In that layout the products are rendered in a static two-column grid and no slider/carousel is needed. On mobile/tablet the carousel still initializes normally.

Override this method to add custom conditions for carousel initialization.

Signature:

protected shouldInitCarousel(): boolean;

Returns:

boolean

true if the carousel should be initialized, false to skip it

Example

Override to always disable carousel:

protected shouldInitCarousel() {
  return false;
}