Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix payment method name for the pay for order page #4047

Open
wants to merge 2 commits into
base: add/spe-classic-checkout-implementation
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,20 @@ public function __construct() {
*/
public function get_title( $payment_details = false ) {
$wallet_type = WC_Stripe_Payment_Methods::AMAZON_PAY === ( $payment_details->type ?? null ) ? WC_Stripe_Payment_Methods::AMAZON_PAY : ( $payment_details->card->wallet->type ?? null );
if ( $payment_details && $wallet_type ) {
return $this->get_card_wallet_type_title( $wallet_type );
}
if ( $payment_details ) {
if ( $wallet_type ) {
return $this->get_card_wallet_type_title( $wallet_type );
}

if ( $this->spe_enabled ) {
if ( $payment_details ) { // Setting title for the order details page / thank you page.
// Setting title for the order details page / thank you page (classic checkout) when SPE is enabled.
if ( $this->spe_enabled ) {
foreach ( WC_Stripe_UPE_Payment_Gateway::UPE_AVAILABLE_METHODS as $payment_method_class ) {
$payment_method = new $payment_method_class();
if ( $payment_method->get_id() === $payment_details->type ) {
return $payment_method->get_title();
}
}
}

// Classic checkout page
return __( 'Stripe', 'woocommerce-gateway-stripe' );
}

return parent::get_title();
Expand Down
Loading