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

Always show Express payment buttons for Pay for Order page #7535

Merged
merged 4 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions changelog/fix-express-pay-pay-for-order-page
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Show Google Pay/Apple Pay buttons in the Pay for Order page
7 changes: 5 additions & 2 deletions includes/class-wc-payments-payment-request-button-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For future eyes: This is removed from here because it injects a div in the page with the same id expected for Apple/Google Pay creating the button in the top of the page instead of close to WooPay and other express payments.

}

/**
Expand Down Expand Up @@ -531,6 +529,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' ) ) ||
Expand Down
Loading