Skip to content

Commit

Permalink
Merge pull request #1467 from Automattic/update/entrepreneur-my-home-…
Browse files Browse the repository at this point in the history
…link

Entrepreneur my home goes to Calypso instead
  • Loading branch information
JuanLucha authored May 14, 2024
2 parents 0c259d0 + 4c6567d commit 7b3101a
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions includes/class-wc-calypso-bridge-ecommerce-admin-menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
}
}

/**
Expand Down Expand Up @@ -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 );
}
}

0 comments on commit 7b3101a

Please sign in to comment.