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, … Read more