Skip to content

Commit af70abd

Browse files
author
Stanislav Idolov
authored
ENGCOM-2050: [Backport] Variant product image in sidebar wishlist block #15699
2 parents 16fbce4 + 98e11b5 commit af70abd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

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

0 commit comments

Comments
 (0)