I made this code to redirect to the course in case the product is associated.
function redirectTutorCourse() {
$post_id = get_queried_object_id();
$is_tutor = get_post_meta( $post_id ,'_tutor_product', true);
if($is_tutor == 'yes'){
global $wpdb;
$results = $wpdb->get_results( "SELECT post_id FROM $wpdb->postmeta WHERE meta_value = " . $post_id ." AND meta_key = '_tutor_course_product_id' ", ARRAY_A );
if(isset($results[0]['post_id'])){
wp_redirect( get_permalink($results[0]['post_id']));
}
}
}
add_action( 'template_redirect', 'redirectTutorCourse' );
It can be added in the functions.php of the child theme.
I hope that helps.