Skip to content

Commit

Permalink
Set gateway method title when the title is defined (#9982)
Browse files Browse the repository at this point in the history
Co-authored-by: Timur Karimov <timur@Timurs-MacBook-Pro.local>
  • Loading branch information
timur27 and Timur Karimov authored Dec 18, 2024
1 parent bf363d6 commit 6639fe9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions changelog/fix-method-title-availability
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Set payment method title once title is known.
6 changes: 3 additions & 3 deletions includes/class-wc-payment-gateway-wcpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit 6639fe9

Please sign in to comment.