Custom Post type menu highlighted in the archive/post

You have it almost right. Try the following:

function add_active_classes($classes = array(), $menu_item = false){
global $wp_query;

if(in_array('current-menu-item', $menu_item->classes)){
    $classes[] = 'current-menu-item';
}

if ( $menu_item->title == 'product' && is_post_type_archive('product') ) {
    $classes[] = 'current-menu-item';
}

if ( $menu_item->title== 'product' && is_singular('product') ) {
    $classes[] = 'current-menu-item';
}


return $classes;
}
add_filter( 'nav_menu_css_class', 'add_active_classes', 10, 2 );

I assume that your custom post type is called “product” and that you have a page with that slug created and added to your menu