From 4a8d48f05b5d15760c8cf7365ed50d90ae22c639 Mon Sep 17 00:00:00 2001 From: Adam Borowski Date: Thu, 19 Oct 2023 11:22:43 +0200 Subject: [PATCH 1/2] fix(modal-checkout): remove login prompt from initial flow Introduced here (https://github.com/Automattic/newspack-blocks/pull/1550#issuecomment-1755996086), but if the key and order are not valid, this template will not be rendered at all. --- src/modal-checkout/templates/form-login.php | 23 ++++----------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/modal-checkout/templates/form-login.php b/src/modal-checkout/templates/form-login.php index 97a464093..b21f6f55f 100644 --- a/src/modal-checkout/templates/form-login.php +++ b/src/modal-checkout/templates/form-login.php @@ -30,15 +30,16 @@ function newspack_blocks_replace_login_with_order_summary() { $order = isset( $_GET['order_id'] ) ? \wc_get_order( \absint( \wp_unslash( $_GET['order_id'] ) ) ) : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended $key = isset( $_GET['key'] ) ? \wc_clean( \sanitize_text_field( \wp_unslash( $_GET['key'] ) ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended $is_valid = $order && is_a( $order, 'WC_Order' ) && hash_equals( $order->get_order_key(), $key ); // Validate order key to prevent CSRF. + + if ( ! $is_valid ) { + return; + } ?>
- -

- -

-

- My Account to see order details.', 'newspack-blocks' ), - \wc_get_account_endpoint_url( 'dashboard' ) - ), - 'newspack-blocks' - ); - ?> -

-
Date: Thu, 19 Oct 2023 11:28:49 +0200 Subject: [PATCH 2/2] fix: hide WC's login prompt --- src/modal-checkout/checkout.scss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modal-checkout/checkout.scss b/src/modal-checkout/checkout.scss index 0806314d7..a136a4502 100644 --- a/src/modal-checkout/checkout.scss +++ b/src/modal-checkout/checkout.scss @@ -184,6 +184,9 @@ display: none; // Hide the "Please log in to view this order" message on the thank you page. } } + .woocommerce-form-login-toggle { + display: none; // Hide the "Returning customer? Click here to login" message. + } .woocommerce-order-overview { color: colors.$color__text-light; list-style: none;