diff --git a/includes/class-wc-calypso-bridge-ecommerce-admin-menu.php b/includes/class-wc-calypso-bridge-ecommerce-admin-menu.php index 13647da9..4fd26ffb 100644 --- a/includes/class-wc-calypso-bridge-ecommerce-admin-menu.php +++ b/includes/class-wc-calypso-bridge-ecommerce-admin-menu.php @@ -262,6 +262,18 @@ public function add_my_home_menu() { 'wpcom-hosting-menu', esc_url( "https://wordpress.com/home/{$this->domain}" ) ); + + // If we have entrepreneur plan, we change the url of home + if ( $this->has_entrepreneur_plan() ) { + $this->update_menu( + 'index.php', + 'https://wordpress.com/home/' . $this->domain . '?flags=entrepreneur-my-home', + $label, + 'edit_posts', + 'dashicons-admin-home' + ); + remove_submenu_page( 'index.php', 'admin.php?page=wc-admin' ); + } } /** @@ -644,4 +656,26 @@ public function add_jetpack_menu() { } ); } } + + /** + * Check if the site has Entrepreneur plan + * + * @return bool + */ + protected function has_entrepreneur_plan() { + $current_plan = get_option( 'jetpack_active_plan', array() ); + if ( empty( $current_plan ) ) { + return false; + } + + $entrepreneur_plans = [ + 'ecommerce-bundle-monthly', + 'ecommerce-bundle', + 'ecommerce-bundle-2y', + 'ecommerce-bundle-3y', + 'ecommerce-trial-bundle-monthly', + ]; + + return in_array( $current_plan['product_slug'], $entrepreneur_plans, true ); + } }