From 8b9fc81cf87f10ddc694d5ff42db0494684179f4 Mon Sep 17 00:00:00 2001 From: frosso Date: Thu, 7 Nov 2024 12:53:51 +0100 Subject: [PATCH] update: show LPM icon on order success page --- assets/css/success.css | 6 +++--- assets/css/success.rtl.css | 6 +++--- changelog/update-order-success-lpm-icon | 4 ++++ .../class-wc-payments-order-success-page.php | 21 +++++++++++-------- 4 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 changelog/update-order-success-lpm-icon diff --git a/assets/css/success.css b/assets/css/success.css index 8ada2af0ee6..f11e45dd18a 100644 --- a/assets/css/success.css +++ b/assets/css/success.css @@ -3,13 +3,13 @@ align-items: center; flex-wrap: wrap; line-height: 1; + padding-top: 4px; } .wc-payment-gateway-method-logo-wrapper img { margin-right: 0.5rem; - padding-top: 4px; } -.wc-payment-gateway-method-logo-wrapper.wc-payment-bnpl-logo img { - max-height: 30px; +.wc-payment-gateway-method-logo-wrapper.wc-payment-lpm-logo img { + max-height: 26px; } diff --git a/assets/css/success.rtl.css b/assets/css/success.rtl.css index 16c136a0b1e..c0778375319 100644 --- a/assets/css/success.rtl.css +++ b/assets/css/success.rtl.css @@ -3,13 +3,13 @@ align-items: center; flex-wrap: wrap; line-height: 1; + padding-top: 4px; } .wc-payment-gateway-method-logo-wrapper img { margin-left: 0.5rem; - padding-top: 4px; } -.wc-payment-gateway-method-logo-wrapper.wc-payment-bnpl-logo img { - max-height: 30px; +.wc-payment-gateway-method-logo-wrapper.wc-payment-lpm-logo img { + max-height: 26px; } diff --git a/changelog/update-order-success-lpm-icon b/changelog/update-order-success-lpm-icon new file mode 100644 index 00000000000..d0f4ac443af --- /dev/null +++ b/changelog/update-order-success-lpm-icon @@ -0,0 +1,4 @@ +Significance: patch +Type: update + +update: show LPM payment method icon on order success page diff --git a/includes/class-wc-payments-order-success-page.php b/includes/class-wc-payments-order-success-page.php index 8051d8aab1c..a1292f25b1e 100644 --- a/includes/class-wc-payments-order-success-page.php +++ b/includes/class-wc-payments-order-success-page.php @@ -5,6 +5,7 @@ * @package WooCommerce\Payments */ +use WCPay\Constants\Payment_Method; use WCPay\Duplicate_Payment_Prevention_Service; /** @@ -78,14 +79,16 @@ public function show_woocommerce_payments_payment_method_name( $payment_method_t } $payment_method = $gateway->get_payment_method( $order ); + // GooglePay/ApplePay/Link/Card to be supported later. + if ( $payment_method->get_id() === Payment_Method::CARD ) { + return $payment_method_title; + } - // If this is a BNPL order, return the html for the BNPL payment method name. - if ( $payment_method->is_bnpl() ) { - $bnpl_output = $this->show_bnpl_payment_method_name( $gateway, $payment_method ); + // If this is an LPM (BNPL or local payment method) order, return the html for the payment method name. + $name_output = $this->show_lpm_payment_method_name( $gateway, $payment_method ); - if ( false !== $bnpl_output ) { - return $bnpl_output; - } + if ( false !== $name_output ) { + return $name_output; } return $payment_method_title; @@ -116,14 +119,14 @@ public function show_woopay_payment_method_name( $order ) { } /** - * Add the BNPL logo to the payment method name on the order received page. + * Add the LPM logo to the payment method name on the order received page. * * @param WC_Payment_Gateway_WCPay $gateway the gateway being shown. * @param WCPay\Payment_Methods\UPE_Payment_Method $payment_method the payment method being shown. * * @return string|false */ - public function show_bnpl_payment_method_name( $gateway, $payment_method ) { + public function show_lpm_payment_method_name( $gateway, $payment_method ) { $method_logo_url = apply_filters( 'wc_payments_thank_you_page_bnpl_payment_method_logo_url', $payment_method->get_payment_method_icon_for_location( 'checkout', false, $gateway->get_account_country() ), @@ -137,7 +140,7 @@ public function show_bnpl_payment_method_name( $gateway, $payment_method ) { ob_start(); ?> -