Skip to content

Commit 51d838c

Browse files
author
Stanislav Idolov
authored
ENGCOM-2064: [Forwardport] Variant product image in sidebar wishlist block #15698
2 parents 6b168c5 + 67d2dc2 commit 51d838c

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
@@ -149,6 +149,14 @@ protected function getItemData(\Magento\Wishlist\Model\Item $wishlistItem)
149149
*/
150150
protected function getImageData($product)
151151
{
152+
/*Set variant product if it is configurable product.
153+
It will show variant product image in sidebar instead of configurable product image.*/
154+
$simpleOption = $product->getCustomOption('simple_product');
155+
if ($simpleOption !== null) {
156+
$optionProduct = $simpleOption->getProduct();
157+
$product = $optionProduct;
158+
}
159+
152160
/** @var \Magento\Catalog\Helper\Image $helper */
153161
$helper = $this->imageHelperFactory->create()
154162
->init($product, 'wishlist_sidebar_block');

0 commit comments

Comments
 (0)