Skip to content

Commit eea948d

Browse files
kp-drcdmytro-ch
authored andcommitted
Variant product image in sidebar wishlist block
1 parent 943e2cd commit eea948d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

app/code/Magento/Wishlist/CustomerData/Wishlist.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ protected function getItemData(\Magento\Wishlist\Model\Item $wishlistItem)
149149
*/
150150
protected function getImageData($product)
151151
{
152+
/* Set variant product if it is configurable product. It will show variant product image in sidebar instead of configurable product image. */
153+
$simpleOption = $product->getCustomOption('simple_product');
154+
if ($simpleOption !== null) {
155+
$optionProduct = $simpleOption->getProduct();
156+
$product = $optionProduct;
157+
}
158+
152159
/** @var \Magento\Catalog\Helper\Image $helper */
153160
$helper = $this->imageHelperFactory->create()
154161
->init($product, 'wishlist_sidebar_block');

0 commit comments

Comments
 (0)