Question

I have tried to override this template file by overriding the whole block where its called i.e Magento\Payment\Block\Info

But i am not able to override this file Magento_Payment::info/default.phtml

Is their any way we can override this file ?

No correct solution

OTHER TIPS

di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Payment\Block\Info">
        <plugin name="module_paympent_view_override_template" type="Vendor\Module\Plugin\Payment\Block\Info" />
    </type>
</config>

Info.php

<?php
namespace Vendor\Module\Plugin\Payment\Block;
 
class Info
{
    public function beforeToHtml(\Magento\Payment\Block\Info $subject)
    {        
            $subject->setTemplate('Vendor_Module::info/default.phtml');        
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top