diff --git a/plugins/woocommerce-admin/src/Features/OnboardingSetUpShipping.php b/plugins/woocommerce-admin/src/Features/OnboardingSetUpShipping.php index 10f3d794ad9..048e5c67e2d 100644 --- a/plugins/woocommerce-admin/src/Features/OnboardingSetUpShipping.php +++ b/plugins/woocommerce-admin/src/Features/OnboardingSetUpShipping.php @@ -63,8 +63,18 @@ class OnboardingSetUpShipping { return; } - $user_token = \Jetpack_Data::get_access_token( JETPACK_MASTER_USER ); - $jetpack_connected = isset( $user_token->external_user_id ); + if ( defined( 'JETPACK_MASTER_USER' ) ) { + $user_token = \Jetpack_Data::get_access_token( JETPACK_MASTER_USER ); + $jetpack_connected = isset( $user_token->external_user_id ); + } else { + /** + * Filter allowing to set the status of the jetpack connection wiuthout setting constant `JETPACK_MASTER_USER` + * + * @param bool $is_connected False. + */ + $jetpack_connected = apply_filters( 'woocommerce_admin_is_jetpack_connected', false ); + } + $wcs_version = \WC_Connect_Loader::get_wcs_version(); $wcs_tos_accepted = \WC_Connect_Options::get_option( 'tos_accepted' ); diff --git a/plugins/woocommerce-admin/src/Features/ShippingLabelBanner.php b/plugins/woocommerce-admin/src/Features/ShippingLabelBanner.php index 19d1124c7e9..ee1b43267bf 100644 --- a/plugins/woocommerce-admin/src/Features/ShippingLabelBanner.php +++ b/plugins/woocommerce-admin/src/Features/ShippingLabelBanner.php @@ -59,9 +59,14 @@ class ShippingLabelBanner { $wcs_tos_accepted = null; if ( class_exists( '\Jetpack_Data' ) ) { - $user_token = \Jetpack_Data::get_access_token( JETPACK_MASTER_USER ); - $jetpack_connected = isset( $user_token->external_user_id ); + if ( defined( 'JETPACK_MASTER_USER' ) ) { + $user_token = \Jetpack_Data::get_access_token( JETPACK_MASTER_USER ); + $jetpack_connected = isset( $user_token->external_user_id ); + } else { + $jetpack_connected = apply_filters( 'woocommerce_admin_is_jetpack_connected', false ); + } + $jetpack_version = JETPACK__VERSION; }