diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Image.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Image.php
index 02a897d44b3c6..f76543527e0fd 100644
--- a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Image.php
+++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Column/Image.php
@@ -11,10 +11,67 @@
*/
namespace Magento\Wishlist\Block\Customer\Wishlist\Item\Column;
+use Magento\Catalog\Model\Product\Image\UrlBuilder;
+use Magento\Framework\View\ConfigInterface;
+use Magento\Framework\App\ObjectManager;
+use Magento\Quote\Model\Quote\ItemFactory;
+use Magento\Checkout\Block\Cart\Item\Renderer;
+
/**
* @api
* @since 100.0.2
*/
class Image extends \Magento\Wishlist\Block\Customer\Wishlist\Item\Column
{
+ /** @var \Magento\Checkout\Block\Cart\Item\Renderer[] */
+ private $renderers = [];
+
+ /** @var \Magento\Quote\Model\Quote\ItemFactory */
+ private $itemFactory;
+
+ /**
+ * @param \Magento\Catalog\Block\Product\Context $context
+ * @param \Magento\Framework\App\Http\Context $httpContext
+ * @param array $data
+ * @param ConfigInterface|null $config
+ * @param UrlBuilder|null $urlBuilder
+ * @param Renderer[] $renderers
+ * @param ItemFactory|null $itemFactory
+ */
+ public function __construct(
+ \Magento\Catalog\Block\Product\Context $context,
+ \Magento\Framework\App\Http\Context $httpContext,
+ array $data = [],
+ ConfigInterface $config = null,
+ UrlBuilder $urlBuilder = null,
+ array $renderers = [],
+ ItemFactory $itemFactory = null
+ ) {
+ $this->renderers = $renderers;
+ $this->itemFactory = $itemFactory ?? ObjectManager::getInstance()->get(ItemFactory::class);
+ parent::__construct(
+ $context,
+ $httpContext,
+ $data,
+ $config,
+ $urlBuilder
+ );
+ }
+
+ /**
+ * Identify the product from which thumbnail should be taken.
+ *
+ * @return \Magento\Catalog\Model\Product
+ */
+ public function getProductForThumbnail(\Magento\Wishlist\Model\Item $item)
+ {
+ $product = $product = $item->getProduct();
+ if (isset($this->renderers[$product->getTypeId()])) {
+ $quoteItem = $this->itemFactory->create(['data' => $item->getData()]);
+ $quoteItem->setProduct($product);
+ $quoteItem->setOptions($item->getOptions());
+ return $this->renderers[$product->getTypeId()]->setItem($quoteItem)->getProductForThumbnail();
+ }
+ return $product;
+ }
}
diff --git a/app/code/Magento/Wishlist/etc/frontend/di.xml b/app/code/Magento/Wishlist/etc/frontend/di.xml
index 00642b132bfdf..802f3612f2c9b 100644
--- a/app/code/Magento/Wishlist/etc/frontend/di.xml
+++ b/app/code/Magento/Wishlist/etc/frontend/di.xml
@@ -47,4 +47,12 @@
+
+
+
+ - Magento\ConfigurableProduct\Block\Cart\Item\Renderer\Configurable
+ - Magento\GroupedProduct\Block\Cart\Item\Renderer\Grouped
+
+
+
diff --git a/app/code/Magento/Wishlist/view/frontend/templates/item/column/image.phtml b/app/code/Magento/Wishlist/view/frontend/templates/item/column/image.phtml
index 1008f5f377df5..2eb4664991e99 100644
--- a/app/code/Magento/Wishlist/view/frontend/templates/item/column/image.phtml
+++ b/app/code/Magento/Wishlist/view/frontend/templates/item/column/image.phtml
@@ -13,5 +13,5 @@ $item = $block->getItem();
$product = $item->getProduct();
?>
- = $block->getImage($product, 'wishlist_thumbnail')->toHtml() ?>
+ = $block->getImage($block->getProductForThumbnail($item), 'wishlist_thumbnail')->toHtml() ?>