How to show only part of product name in category page – WordPress with woocomerce

I solved this problem with:

function hide_product_title_part( $title, $id ) {
  if ( ( is_front_page() || is_shop() || is_product_tag() || is_product_category() ) && get_post_type( $id ) === 'product' ) {
    if (strstr($title, ":")) {
      $new_title = explode(":", $title);
      return $new_title[1];
    } else {
      return $title;
    }
  } else {
    return $title;
  }
}
add_filter( 'the_title', 'hide_product_title_part', 10, 2 );