Default Magento payment method "Bank Tranfer" does not allow using HTML tags in Instructions text.

How can I change that?

  • Can you please give graphical detail what you actually want in your question ? Apr 5, 2019 at 12:02

1 Answer 1


As I understood you want to add some HTML tags to Bank transfer Payment method.

By default Magento escapeHtml when rendering Instruction for COD and Bank transfer Payment.

We need to Create a small module which will override getInstructions function.

let's create a module Pawan_Instructions.




<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Pawan_Instructions" setup_version="1.0.0">


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\OfflinePayments\Model\InstructionsConfigProvider" type="Pawan\Instructions\Model\Rewrite\InstructionsConfigProvider" />



namespace Pawan\Instructions\Model\Rewrite;
class InstructionsConfigProvider extends \Magento\OfflinePayments\Model\InstructionsConfigProvider

    public function getInstructions($code)
        if($code == 'banktransfer'){//check payment method is banktransfer
            return nl2br($this->methods[$code]->getInstructions());// removed escapeHtml function!
            return nl2br($this->escaper->escapeHtml($this->methods[$code]->getInstructions()));


Final Result will be:

Admin enter image description here

Front Admin

Note: I have checked and allow html tag for only banktransfer code, if you want for both, you can skip If condition.

Update I

Above code will only work for Front-end because for admin there is separate phtml file is responsible for showing payment method instruction.

If You also want to remove escapeHtml for Admin, follow below instruction:

Create di.xml (for override template) at:


<?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\OfflinePayments\Block\Form\Banktransfer">
        <plugin name="override_template" type="Pawan\Instructions\Plugin\OfflinePayments\Block\Form\Bank" />

Create Bank.php at :


namespace Pawan\Instructions\Plugin\OfflinePayments\Block\Form;

class Bank
    public function beforeToHtml(\Magento\OfflinePayments\Block\Form\Banktransfer $subject)

create banktransfer.phtml at:


$instructions = $block->getInstructions();
<?php if ($instructions) : ?>
    <?php $methodCode = $block->escapeHtml($block->getMethodCode());?>
    <ul class="form-list checkout-agreements" id="payment_form_<?= /* @noEscape */ $methodCode ?>" style="display:none;">
            <div class="<?= /* @noEscape */ $methodCode ?>-instructions-content checkout-agreement-item-content">
                <?= /* @noEscape */ $instructions ?>
<?php endif; ?>
  • This is working fine for the frontend. I have displayed an image on the frontend but in the backend, only the image URL is showing. Oct 14, 2020 at 6:51
  • @VinodKumar Same prblm at my end. Did u got any solution for this?
    – Nafsss
    Mar 22, 2021 at 8:09
  • @Nafsss please see my Update I in answer
    – Pawan
    Mar 25, 2021 at 10:44
  • @VinodKumar please see my Update I in answer..
    – Pawan
    Mar 25, 2021 at 10:44
  • In magento sales email?
    – yavonz15
    Apr 27, 2022 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.