Home > widget-integration > CartDrawerRecommendationController > getImageWidth

CartDrawerRecommendationController.getImageWidth() method

Get the image width for recommendation product images. Checks widget design settings first, then falls back to default.

Override this method to customize image width calculation.

Signature:

protected getImageWidth(): number;

Returns:

number

Image width in pixels

Example

Override to use a different image width for retina displays:

protected getImageWidth() {
  return window.devicePixelRatio > 1 ? 600 : 300;
}