diff --git a/includes/class-modal-checkout.php b/includes/class-modal-checkout.php index 705e02049..d1a0970d3 100644 --- a/includes/class-modal-checkout.php +++ b/includes/class-modal-checkout.php @@ -130,13 +130,7 @@ public static function woocommerce_payment_successful_result( $result ) { $order_id = $result['order_id']; $order = \wc_get_order( $order_id ); $modal_checkout_url = $order->get_meta( '_newspack_modal_checkout_url' ); - if ( - empty( $modal_checkout_url ) || - ( - // Until we use the modal checkout flow from My Account, we don't want to show the modal checkout thank you template for checkouts originating from My Account. - method_exists( 'Newspack\WooCommerce_My_Account', 'is_from_my_account' ) && \Newspack\WooCommerce_My_Account::is_from_my_account() - ) - ) { + if ( empty( $modal_checkout_url ) ) { return $result; } @@ -1080,6 +1074,10 @@ public static function hide_expiry_message_shop_link( $message ) { * Is this request using the modal checkout? */ public static function is_modal_checkout() { + // Until we use the modal checkout flow from My Account, we don't want to show the modal checkout thank you template for checkouts originating from My Account. + if ( method_exists( 'Newspack\WooCommerce_My_Account', 'is_from_my_account' ) && \Newspack\WooCommerce_My_Account::is_from_my_account() ) { + return false; + } $is_modal_checkout = isset( $_REQUEST['modal_checkout'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( ! $is_modal_checkout && isset( $_REQUEST['post_data'] ) && is_string( $_REQUEST['post_data'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended