Solved: Category Image Deletes After Initial Save in Magento 2

Magento 2 migration is recommended by experts owing to the security issues in Magento 1. Moreover, the store owner can leverage features like page builder, enhanced GraphQL, better admin panel, etc. with the latest Magento 2.4.3

However, sometimes, store owners face issues like category image deletes after initial save in Magento 2 after the site migration. Either the category image uploaded cannot be seen in the frontend or editing the image does not work.

The solution to this issue is given below:

Solution for Category Image Deletes After Initial Save in Magento 2 Issue:

Open vendor\magento\module-catalog\Model\Category\Attribute\Backend\Image.php

Edit function afterSave and put below code:

That’s it.

I suggest that you override this file in any extension, do not directly change it in the vendor folder.

Any doubts in the above solution can be mentioned in the Comments section below. I’d be happy to help.

Please share the solution with the Magento Community via social media.

Thank you.

5
(based on 5 Reviews)
Solved: Category Image Deletes After Initial Save in Magento 2Author Magento Badge

Jignesh Parmar

An expert in his field, Jignesh is the team leader at Meetanshi and a certified Magento developer. His passion for Magento has inspired others in the team too. Apart from work, he is a cricket lover.

Leave a Reply

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