PHP Code Used
add_filter( 'the_title', 'custom_the_title', 10, 2 );
function custom_the_title( $title, $post_id ) {
$post_type = get_post_field( 'post_type', $post_id, true );
if( $post_type == 'product' || $post_type == 'product_variation' ) {
$title = str_replace( 'Blue Denim', '<span style="color: #0B65CD;">Blue Denim</span><br>', $title );
}
return $title;
}