Display funding source on the admin order page

Now the payment method title on the admin order editing page includes the funding source instead of just "PayPal" the same as in the order list.
This commit is contained in:
Alex P 2023-06-20 10:30:15 +03:00
parent 74611528b5
commit e70299e42b
No known key found for this signature in database
GPG key ID: 54487A734A204D71

View file

@ -271,6 +271,27 @@ class PayPalGateway extends \WC_Payment_Gateway {
$this->order_endpoint = $order_endpoint;
}
/**
* Return the gateway's title.
*
* @return string
*/
public function get_title() {
if ( is_admin() ) {
// $theorder and other things for retrieving the order or post info are not available
// in the constructor, so must do it here.
global $theorder;
if ( $theorder instanceof WC_Order ) {
$payment_method_title = $theorder->get_payment_method_title();
if ( $payment_method_title ) {
$this->title = $payment_method_title;
}
}
}
return parent::get_title();
}
/**
* Whether the Gateway needs to be setup.
*