-2

I'm on checkout page! I've created a new payment gateway called "others", the user choose this gateway and a drop-down list with payment options such as "Visa, MasterCard, etc" becomes available. When the user choose an option e.g.:"VISA", I want that the payment method title becomes "VISA", not "others". I've try to use:

$order->set_payment_method_title($_POST[$this->id.'-admin-note']);

But it doesn't work. Can someone help me? Does someone know how to change the payment method title?

Paul Kertscher
  • 9,416
  • 5
  • 32
  • 57

2 Answers2

0

Hello this was the solution i found.

update_post_meta( $order_id, '_payment_method_title', 'Pay' );

0

It seems that there are two relevant order meta data fields:

  • _payment_method_title is used in emails
  • '_payment_method is the one displayed in the admin panel.

So you should probably update both. If you have the order object, you can do:

$order->update_meta_data('_payment_method', 'My payment method');
$order->update_meta_data('_payment_method_title', 'My payment method');
user905686
  • 4,491
  • 8
  • 39
  • 60