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 ? – Hassan Ali Shahzad Apr 5 '19 at 12:02

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.

| improve this answer | |
  • 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. – Vinod Kumar Oct 14 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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