From 6639fe9fb7887e828ebc0386e6f4c536602d0e7d Mon Sep 17 00:00:00 2001 From: Timur Karimov Date: Wed, 18 Dec 2024 13:53:34 +0100 Subject: [PATCH] Set gateway method title when the title is defined (#9982) Co-authored-by: Timur Karimov --- changelog/fix-method-title-availability | 4 ++++ includes/class-wc-payment-gateway-wcpay.php | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 changelog/fix-method-title-availability diff --git a/changelog/fix-method-title-availability b/changelog/fix-method-title-availability new file mode 100644 index 00000000000..d9d2a0c0217 --- /dev/null +++ b/changelog/fix-method-title-availability @@ -0,0 +1,4 @@ +Significance: minor +Type: fix + +Set payment method title once title is known. diff --git a/includes/class-wc-payment-gateway-wcpay.php b/includes/class-wc-payment-gateway-wcpay.php index 3e02aa6acf5..4f579caf2b1 100644 --- a/includes/class-wc-payment-gateway-wcpay.php +++ b/includes/class-wc-payment-gateway-wcpay.php @@ -321,8 +321,7 @@ public function __construct( ]; if ( 'card' !== $this->stripe_id ) { - $this->id = self::GATEWAY_ID . '_' . $this->stripe_id; - $this->method_title = "WooPayments ($this->title)"; + $this->id = self::GATEWAY_ID . '_' . $this->stripe_id; } // Capabilities have different keys than the payment method ID's, @@ -366,7 +365,8 @@ public function __construct( * @return string */ public function get_title() { - $this->title = $this->payment_method->get_title(); + $this->title = $this->payment_method->get_title(); + $this->method_title = "WooPayments ($this->title)"; return parent::get_title(); }