Use connection tab when no tab specified and not onboarded

This commit is contained in:
Alex P 2022-09-26 10:46:35 +03:00
parent 7002c2e6d3
commit b717af3a1d

View file

@ -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;
},