Editing the default core files is not advised by Magento 2 as you risk losing your customizations if you update to the most recent Magento 2 version. The more effective way to handle this situation is to change the fundamental functionality by modifying the core files, classes, blocks, and methods.

When we override the widget block class, it occasionally requires adding the relevant template file to the override block with the same directory path as the original.

Follow this shared method to override product NewWidget block in Magento 2, When you want to change the new widget block class.
https://meetanshi.com/blog/override-...-in-magento-2/

View more threads in the same category: