If the payment method is bank transfer, I need to show a custom message on success page of Magento 2.

I'm going to say

"don't forget: we will ship to you after your payment received to our bank account; here are our bank details; and you have 2 days left to make your payment"


I found the solution as like below (with editing success.phtml), but you know, I don't want to edit core files.

<?php if ($this->getOrderId()):?>
<div class="bank_detail">
<?php $orderId = $this->getOrderId(); ?>
<?php $order = Mage::getModel("sales/order")->loadByIncrementId($orderId); //load order by increment id?>
<?php $paymentCode = $order->getPayment()->getMethod(); ?>

   <?php if ($paymentCode=='banktransfer') { 
       echo "whatever you want!";
   } //you can also check for other payment method?>

Could someone help me to do this with the module?

  • You can try by 'order.success.additional.info' – kunj May 16 '18 at 13:10
  • it is possible by creating one simple module and call you custom phtml file on the success page. – Nikunj Vadariya May 16 '18 at 13:11
  • @erererer please check my answer and let me know It will help you. – Nikunj Vadariya May 16 '18 at 13:20
  • No need to create any custom module. You can simply create a widget from the admin panel and call it on the checkout success page. – Mohit Kumar Arora May 16 '18 at 13:23
  • could someone help me to modify success.phtml or create custom_info.phtml? i need to say 'if payment method=banktransfer, echo xxxx' etc – erererer May 16 '18 at 20:14

If you don't want to create the new module, you can do it in your theme as well. Follow below steps:

Create checkout_onepage_success.xml in your theme.

For example:


The content of file is:

<?xml version="1.0"?>
    <referenceContainer name="order.success.additional.info">
        <block class="Magento\Checkout\Block\Onepage\Success"

Then you need to create the template file:


You can add your conditional code to this file.

For example:

My bank information is xyz


php bin/magento cache:flush

  • thank you so so much for your kind answer.. but, could you please show me a way with a creating new module? (i need to write bank details, IF payment method is bank transfer) – erererer May 16 '18 at 13:29
  • you can create a system configuration field and add your data to this field and call it on 'custom_info.phtml' it will done :) – Nikunj Vadariya May 16 '18 at 13:33
  • if any answer solves your concern then there is green right tick mark , hit that tickmark for right ansewer that will help future readers. – Nikunj Vadariya May 16 '18 at 13:33
  • May i also please you to give an custom_info.phtml example? if paymentmethod=bank transfer) { echo 'bank details: xxxx'; } etc.. – erererer May 16 '18 at 13:46

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.