Hi dears I want to override taxvat.phtml in vendor > magento > module-customer > view > frontend > templates > widget
Before I try to create a file Vendor > Module > etc > di.xml with this code :
<type name="Magento\Customer\Block\Widget\Name">
<plugin name="vatcode" type="Vendor\Module\Plugin\Customer\Block\Widget\Taxvat"/>
</type>
and in Taxvat code :
namespace Vendor\Module\Plugin\Customer\Block\Widget;
use Magento\Customer\Block\Widget\Taxvat as Taxobj;
class Taxvat
{
public function after_construct(Taxobj $result)
{
$result->setTemplate('Vendor_Module::widget/taxvat.phtml');
return $result;
}
}
after run but i have below error :
Type Error occurred when creating object: Magento\Customer\Block\Widget\Name\Interceptor, Argument 1 passed to Vendor\Module\Plugin\Customer\Block\Widget\Taxvat::after_construct() must be an instance of Magento\Customer\Block\Widget\Taxvat, instance of Magento\Customer\Block\Widget\Name\Interceptor given, called in /public_html/vendor/magento/framework/Interception/Interceptor.php on line 146