add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);
function custom_variation_price($price, $product) {
$available_variations = $product->get_available_variations();
$selectedPrice = '';
$dump = '';
$defaultArray = array();
foreach ($product->get_default_attributes() as $key => $val) {
$defaultArray['attribute_' . $key] = $val;
}
if (empty($defaultArray)) {
$price = $product->get_variation_price( 'min', true );
} else {
foreach ($available_variations as $variation) {
$isDefVariation = false;
$result = array_diff($defaultArray, $variation['attributes']);
if (empty($result)) {
$isDefVariation = true;
$price = $variation['display_price'];
break;
}
}
}
$selectedPrice = wc_price($price);
return $selectedPrice . $dump;
}