🔥 Just Launched! Werra Premium Template for HyväSee it in Action

Solved: No Image for Configurable Product in Magento 2 Cart Page

By Sanjay JethvaUpdated on May 22, 2025 3 min read

Magento 2 store owners have many options available to optimize the store functionality, improve customer experience, capture payments and ease the administrative tasks with 3rd party extensions. Also, there are 3rd party custom themes available to improve the look and feel of the admin panel and storefront.

The only problem with these 3rd party themes and extensions is that sometimes it disrupts the features of default Magento 2 or conflicts with default configuration.

One such issue is No Image for Configurable Product in Magento 2 Cart Page. The simple product image of a configurable product is not displayed in the cart page due to 3rd party extensions or themes.

Generally, the developers follow below steps for fixing the problem:

Preconditions

  1. Magento 2.2.x
  2. Create a configurable product.

Steps to Reproduce

  1. Create a configurable product.
  2. Add images for all child products
  3. Do not add images for parent products.
  4. Add that product in cart page.

It is expected that images of child product are displayed on cart page. If a child product has no images then images of the parent product are displayed.

Unfortunately, it’s not the case 

Product image not showing issue for configurable product

To overcome this issue, one needs to override the Magento 2 code file. Let’s see how to do it.

Solution: No Image for Configurable Product in Magento 2 Cart Page

Copy [MAGENTO_ROOT]vendormagentomodule-catalogBlockProductImageBuilder.php and paste it to [MAGENTO_ROOT]appcodeMagentoCatalogBlockProductImageBuilder.php 

find the following code:

if ($simpleOption !== null)
 
       {
            $optionProduct = $simpleOption->getProduct();
            $this->setProduct($optionProduct);
        }

And, replace it with the below code:

if ($simpleOption !== null)
 
        {
            $optionProduct = $simpleOption->getProduct();
            $objectManager = MagentoFrameworkAppObjectManager::getInstance();
            $product = $objectManager->create('MagentoConfigurableProductModelResourceModelProductTypeConfigurable')->getParentIdsByChild($optionProduct->getEntityId());
            $parentProduct = $objectManager->create('MagentoCatalogModelProduct')->load($product[0]);
            $this->setProduct($parentProduct);
        }

That’s all you have to do to solve No Image for Configurable Product in Magento 2 Cart Page!

The post will be helpful to display the product images of the configurable product in Magento 2 cart page.

Thank You ?

Sanjay Jethva Full Image
Article bySanjay Jethva

Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe. His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.