Skip to content

Commit 4fb3443

Browse files
committed
fix: prevent blocks detection from blocking scripts on order-pay pages
The is_block_checkout_page() method was checking if the main checkout page uses blocks, which incorrectly prevented classic checkout scripts from loading on order-pay and add-payment-method pages (which are always classic, even when main checkout uses blocks). Added early returns to detect order-pay and add-payment-method pages and treat them as classic checkout, ensuring card input, card brands, and payment buttons render correctly. Fixes issue where card input field and card brands disappeared on order-pay page when main checkout was using WooCommerce Blocks.
1 parent 0efb59f commit 4fb3443

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/Gateways/Abstracts/WCMoneiPaymentGateway.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,10 @@ public function isBlockCheckout() {
370370
* @return bool
371371
*/
372372
public function is_block_checkout_page() {
373+
// Order-pay and add payment method pages are always classic
374+
if ( is_checkout_pay_page() || is_add_payment_method_page() ) {
375+
return false;
376+
}
373377
if ( ! is_checkout() ) {
374378
return false;
375379
}

src/Gateways/Abstracts/WCMoneiPaymentGatewayComponent.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,10 @@ public function isBlockCheckout() {
300300
* @return bool
301301
*/
302302
public function is_block_checkout_page() {
303+
// Order-pay and add payment method pages are always classic
304+
if ( is_checkout_pay_page() || is_add_payment_method_page() ) {
305+
return false;
306+
}
303307
if ( ! is_checkout() ) {
304308
return false;
305309
}

src/Gateways/PaymentMethods/WCGatewayMoneiAppleGoogle.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ public function hideAppleGoogleInCheckout( $available_gateways ) {
229229
}
230230

231231
public function isBlockCheckout(): bool {
232+
// Order-pay and add payment method pages are always classic
233+
if ( is_checkout_pay_page() || is_add_payment_method_page() ) {
234+
return false;
235+
}
232236
if ( ! is_checkout() ) {
233237
return false;
234238
}

0 commit comments

Comments
 (0)