I want to show payment method of an order in My Orders customer page.

I have tried use echo $_order->getPaymentMethod(), it gives NULL variable.

I also tried echo $block->getpaymentsCollection()->getTitle(), it shows messy looks without error.

So, what is correct way to show payment method title of an order?


Get the payment model from the order, then get the method instance from the payment:

    $payment = $order->getPayment();
    $method = $payment->getMethodInstance();
    $methodTitle = $method->getTitle();

Where $order is an instance of Magento\Sales\Model\Order.

  • Magento\Sales\Model\Order is not called from the used block.
    – Seventh St
    Jan 30 '17 at 6:00
  • $_order in the My Orders page template is a Magento\Sales\Model\Order. Jan 30 '17 at 6:11
  • forget my deleted comments. I just didn't pay attention :)
    – Seventh St
    Jan 30 '17 at 6:31
  • I get this error. Fatal error: Uncaught Magento\Framework\Exception\LocalizedException: Area code is not set can you please help me @AaronAllen
    – Joey
    Apr 4 '18 at 9:21
  • Please add more details about your code for better understanding
    – Jarnail S
    Dec 15 '20 at 22:02
  • What? If You have Magento\Sales\Model\Order object, You can get payment method title using line above. What do You want to know more? You don't need payment method instance. Just get method title from additional information.
    – Norton
    Dec 16 '20 at 23:52

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.