function get_price_of_current_variant($product, $name, $term_slug) {
$price = 0;
foreach ($product->get_available_variations() as $variation) {
if ($variation['attributes'][$name] == $term_slug)
$price = $variation['display_price'];
}
return $price;
}
add_filter('woocommerce_dropdown_variation_attribute_options_html', 'wt_modifiy_variation_options', 10, 2);
function wt_modifiy_variation_options($html, $args) {
$options = $args['options'];
$product = $args['product'];
$attribute = $args['attribute']; // The product attribute taxonomy
$name = $args['name'] ? $args['name'] : 'attribute_' . sanitize_title($attribute);
$id = $args['id'] ? $args['id'] : sanitize_title($attribute);
$class = $args['class'];
$show_option_none = $args['show_option_none'] ? true : false;
$show_option_none_text = __('Add your custom text in here', 'woocommerce');
if (empty($options) && !empty($product) && !empty($attribute)) {
$attributes = $product->get_variation_attributes();
$options = $attributes[$attribute];
}
$html = '';
return $html;
}
This is the code for what you are looking..