From b717af3a1d7436ca5452a20c08429cf81c75ee9a Mon Sep 17 00:00:00 2001 From: Alex P Date: Mon, 26 Sep 2022 10:46:35 +0300 Subject: [PATCH] Use connection tab when no tab specified and not onboarded --- modules/ppcp-wc-gateway/services.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/ppcp-wc-gateway/services.php b/modules/ppcp-wc-gateway/services.php index c9ac66910..62590006a 100644 --- a/modules/ppcp-wc-gateway/services.php +++ b/modules/ppcp-wc-gateway/services.php @@ -169,6 +169,13 @@ return array( $section = isset( $_GET['section'] ) ? sanitize_text_field( wp_unslash( $_GET['section'] ) ) : ''; $ppcp_tab = isset( $_GET[ SectionsRenderer::KEY ] ) ? sanitize_text_field( wp_unslash( $_GET[ SectionsRenderer::KEY ] ) ) : ''; + $state = $container->get( 'onboarding.state' ); + assert( $state instanceof State ); + + if ( ! $ppcp_tab && PayPalGateway::ID === $section && $state->current_state() !== State::STATE_ONBOARDED ) { + return Settings::CONNECTION_TAB_ID; + } + return $ppcp_tab ? $ppcp_tab : $section; },