How To

How to set Base Image Instead of Thumbnail Image in Minicart of Magento 2

Most of the Ecommerce customers make a buying decision by viewing the product image, and that’s how image plays a vital role in boosting store sales. Because they can’t have hands-on experience until they received their order delivery. That’s why the store owners add multiple product images and videos from different perspectives so the customer can make a more precise decision and reduce product returns. In default Magento 2, there are several image type options using which you can set base Image, small Image, thumb, and open graph/twitter card images for the product.
But things are quite easy when you have a single product image, but when there are multiple images, you have to select image options each time you upload product image and also have to remember their sequence and everything. To make it easy, you can use your base image as product thumb, so you can save your time by using the same image everywhere in Magento 2. By using the base image as a thumb, the same image will be displayed in a mini cart every time your customer adds a product to the shopping cart. Here is code to do the same.
To do the same first, we need to add a small piece of code in frontend “view.xml” file inside your theme folder. But first of all search for the below code in the file.
app\design\frontend\Themes\Yourtheme\etc\view.xml

<image id="mini_cart_product_thumbnail" type="thumbnail">
    <width>75</width>
    <height>75</height>
</image>

Now replace that code with below code.

<image id="mini_cart_product_thumbnail" type="small_image">
    <width>75</width>
    <height>75</height>
</image>

Simply clear the cache and that’s it.
Lastly, if you found this blog helpful, don’t forget to share it with your colleagues and Magento Friends and Let us know if you are facing any issue while implementing this code.
Happy Coding!

Click to rate this post!
[Total: 10 Average: 5]
Dhiren Vasoya

Dhiren Vasoya is a Director and Co-founder at MageComp, Passionate ?️ Certified Magento Developer?‍?. He has more than 9 years of experience in Magento Development and completed 850+ projects to solve the most important E-commerce challenges. He is fond❤️ of coding and if he is not busy developing then you can find him at the cricket ground, hitting boundaries.?

View Comments

Recent Posts

How to Add Tooltip in Checkout Shipping Field in Magento 2?

Hello Magento Friends, In today’s blog, I will explain How to Add Tooltip in Checkout…

2 days ago

How to Integrate and Use MongoDB with Laravel?

MongoDB is a popular NoSQL database that offers flexibility and scalability when handling modern web…

3 days ago

NodeJS | Callback Function

In NodeJS, callbacks empower developers to execute asynchronous operations like reading files, handling requests, and…

4 days ago

How to Show SKU in Order Summary in Magento 2?

Hello Magento Friends, In today’s blog, we will learn How to Show SKU in Order…

6 days ago

Best Colors to Use for CTA Buttons

The "Buy Now" and "Add to Cart" buttons serve as the primary call-to-action (CTA) elements…

1 week ago

Magento 2: How to Save Custom Field Value to quote_address for Multi-Shipping Orders

Hello Magento Friends, In Magento 2, the checkout process allows customers to choose multiple shipping…

1 week ago