How To Override Product NewWidget Block in Magento 2

That’s it!
I would be happy to help.
2 recommends not to edit the default core files as you may lose your customizations when upgrading to the latest Magento 2 version. The better solution to this issue is to modify the core functionality by overriding the core files, classes, blocks, and methods to serve this purpose.

Method to Override Product NewWidget Block in Magento 2

    1. Create di.xml file at app/code/Vendor/Module/etc into the custom module.
    2. Create a block file ProductsList.php at app/code/Vendor/Module/Block/Product to extend the widget class.

Do consider while using preference that another module has not used the same preference in the di.xml file.
Sometimes it requires placing the related template file into the override block with the same directory path as the original when we override the widget block class.
Thank You.
Never miss Magento tips, tricks, tutorials, and news.
Follow this method to override product NewWidget block in Magento 2 when you want to modify new widget block class.
If you have any doubts in the above solution, just mention them in the Comments section below.

Get Weekly Updates

Feel free to share the solution with Magento Community via social media.

Something went wrong.
Thank you for subscribing.




(based on 0 Reviews)