Found it, tested it and it works. Hides shop and redirects to my account if not logged in.
if ( class_exists( ‘Groups_User’ ) ) {
$redirect = true;
if ( $user_id = get_current_user_id() ) {
$user = new Groups_User( $user_id );
if ( $user->can( ‘groups_read_post’ ) ) {
$redirect = false;
}
}
if ( $redirect ) {
wp_redirect( $myaccount_page_id( ‘woocommerce_myaccount_page_id’ ) );
}
}