Following step need to follow
create app/code/Vendor/ModuleName/registration.php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Vendor_ModuleName',
__DIR__
);
create app/code/Vendor/ModuleName/etc/module.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Vendor_ModuleName" setup_version="1.0.0" />
</config>
create app/code/Vendor/ModuleName/etc/di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="ThirdPartyVendor\ThirdpartyModule\Block\File" type="Vendor\ModuleName\Block\File"/>
</config>
create app/code/Vendor/ModuleName/Block/File.php
namespace Vendor\ModuleName\Block;
use ThirdPartyVendor\ThirdpartyModule\Block\File as ThirdPartyFile;
class File extends ThirdPartyFile
{
...........
...........
}
Run Following Command:
bin/magento setup:di:compile
bin/magento c:f
Best Answer
Yes,You can use plugin at here.
Use after,before,around method basic of your requirement.