Skip to content

Commit 600bc64

Browse files
committed
Variant product image in sidebar wishlist block
1 parent a2a2a5d commit 600bc64

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
@@ -147,6 +147,13 @@ protected function getItemData(\Magento\Wishlist\Model\Item $wishlistItem)
147147
*/
148148
protected function getImageData($product)
149149
{
150+
/* Set variant product if it is configurable product. It will show variant product image in sidebar instead of configurable product image. */
151+
$simpleOption = $product->getCustomOption('simple_product');
152+
if ($simpleOption !== null) {
153+
$optionProduct = $simpleOption->getProduct();
154+
$product = $optionProduct;
155+
}
156+
150157
/** @var \Magento\Catalog\Helper\Image $helper */
151158
$helper = $this->imageHelperFactory->create()
152159
->init($product, 'wishlist_sidebar_block');

0 commit comments

Comments
 (0)