Strip string from $_product->get_title() to get a cleaner mini-cart

You need to add a function in your theme’s functions.php file that will find and remove those two words “shorts” and “longshorts” from a php string. Then you can add that function as a filter to the woocommerce_cart_item_name event that is being applied in your mini-cart.php Try something like:

function wpse_remove_shorts_from_cart_title( $product_name ) {
    $product_name = str_ireplace( 'longshorts', '', $product_name ); // remove "longshorts";
    $product_name = str_ireplace( 'shorts', '', $product_name ); // remove "shorts"

    return $product_name;
}
add_filter( 'woocommerce_cart_item_name', 'wpse_remove_shorts_from_cart_title' );

Note, I’ve used str_ireplace() to cover occurrences whether they’re capitalized or not (which is common in titles).