How to change product image in checkout cart in Magento 2

This blog clearly explains the steps that help you to change product image in the checkout cart in Magento-2:

  • Create di.xml file
  • Create image.php file

It’s an easy product with custom selections, where each option has its own color. When they include their modified version of the cart. We have additional set images for chosen option in to final product option. The steps listed below shows you how to change product image in checkout cart in Magento 2:

Step 1: create di.xml file

To create a di.xml file use

<?xml version="1.0"?>

<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">

<type name="Magento\Checkout\Block\Cart\Item\Renderer">

 <plugin name="Change_Product_Image_In_Checkout_Cart" type="[Name_Space]\[Your_Module]\Plugin\CheckoutCart\Image" sortOrder="1"/>



Step 2: create image.php

To create an image.php file use


namespace [Name_Space]\[Your_Module]\Plugin\CheckoutCart;

class Image


    public function afterGetImage($item, $result)



     $result->setImageUrl( YOUR_IMAGE_URL );


     return $result;



I hope, the above mentioned steps guides you to change product image in checkout in Magento 2.

Last Update: February 26, 2019  

February 6, 2018   1384   Nandini Ramachandran    Products    
Total 2 Votes:

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Reply

Your email address will not be published. Required fields are marked *