From 3ea725c9cd579a18d0e6dc05783459d7c39e13f9 Mon Sep 17 00:00:00 2001 From: elazzabi Date: Mon, 23 Oct 2023 12:02:43 +0100 Subject: [PATCH 1/4] Add top-level check for Pay for Order page --- .../class-wc-payments-payment-request-button-handler.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/class-wc-payments-payment-request-button-handler.php b/includes/class-wc-payments-payment-request-button-handler.php index d5308734d4c..36f494766c1 100644 --- a/includes/class-wc-payments-payment-request-button-handler.php +++ b/includes/class-wc-payments-payment-request-button-handler.php @@ -499,6 +499,11 @@ public function should_show_payment_request_button() { return false; } + // Order total doesn't matter for Pay for Order page. Thus, this page should always display payment buttons. + if ( $this->is_pay_for_order_page() ) { + return true; + } + // Page not supported. if ( ! $this->is_product() && ! $this->is_cart() && ! $this->is_checkout() ) { return false; From d43b541162118f003deb06141c732c7a1efa8a17 Mon Sep 17 00:00:00 2001 From: elazzabi Date: Mon, 23 Oct 2023 12:17:44 +0100 Subject: [PATCH 2/4] add changelog --- changelog/fix-express-pay-pay-for-order-page | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelog/fix-express-pay-pay-for-order-page diff --git a/changelog/fix-express-pay-pay-for-order-page b/changelog/fix-express-pay-pay-for-order-page new file mode 100644 index 00000000000..c90c305e91e --- /dev/null +++ b/changelog/fix-express-pay-pay-for-order-page @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Show Google Pay/Apple Pay buttons in the Pay for Order page From 83101c25aa3ff9e64a33e26ab5b22ca5ea89e2d8 Mon Sep 17 00:00:00 2001 From: elazzabi Date: Thu, 26 Oct 2023 14:17:56 +0100 Subject: [PATCH 3/4] Move order of check to before last --- ...lass-wc-payments-payment-request-button-handler.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/class-wc-payments-payment-request-button-handler.php b/includes/class-wc-payments-payment-request-button-handler.php index 36f494766c1..62f501cc410 100644 --- a/includes/class-wc-payments-payment-request-button-handler.php +++ b/includes/class-wc-payments-payment-request-button-handler.php @@ -499,11 +499,6 @@ public function should_show_payment_request_button() { return false; } - // Order total doesn't matter for Pay for Order page. Thus, this page should always display payment buttons. - if ( $this->is_pay_for_order_page() ) { - return true; - } - // Page not supported. if ( ! $this->is_product() && ! $this->is_cart() && ! $this->is_checkout() ) { return false; @@ -536,6 +531,11 @@ public function should_show_payment_request_button() { return false; } + // Order total doesn't matter for Pay for Order page. Thus, this page should always display payment buttons. + if ( $this->is_pay_for_order_page() ) { + return true; + } + // Cart total is 0 or is on product page and product price is 0. if ( ( ! $this->is_product() && 0.0 === (float) WC()->cart->get_total( 'edit' ) ) || From d5e949b50797963e223095fd0248998e46e83944 Mon Sep 17 00:00:00 2001 From: elazzabi Date: Tue, 31 Oct 2023 15:52:44 +0100 Subject: [PATCH 4/4] Remove extra call to $this->display_payment_request_button_html() --- includes/class-wc-payments-payment-request-button-handler.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/includes/class-wc-payments-payment-request-button-handler.php b/includes/class-wc-payments-payment-request-button-handler.php index 62f501cc410..009d36a1f04 100644 --- a/includes/class-wc-payments-payment-request-button-handler.php +++ b/includes/class-wc-payments-payment-request-button-handler.php @@ -381,8 +381,6 @@ public function display_pay_for_order_page_html( $order ) { ]; wp_localize_script( 'WCPAY_PAYMENT_REQUEST', 'wcpayPaymentRequestPayForOrderParams', $data ); - - $this->display_payment_request_button_html(); } /**