Customizing $product->get_title() function

In WooCommerce, the product variants are children of the actual product. So perhaps just check if the $product_id you’re on is a child, and if so get the title of the parent.

Untested code:

// Check if product has parent
if($product->post_parent){
    $parents = get_post_ancestors( $product->ID );

    /* Get the top Level page->ID count base 1, array base 0 so -1 */ 
    $parentId = ($parents) ? $parents[count($parents)-1]: $product->ID;

    $product->name = get_the_title($parentId);
}else{
    $product->name = get_the_title($product->ID);
}