Changing “Choose an option” in Woocommerce!

function get_text_for_select_based_on_attribute($attribute) {
$attribute_name = wc_attribute_label($attribute);
$select_text = 'Select a ' . $attribute_name;
return $select_text;
}
function wc_dropdown_variation_attribute_options( $args = array() ) {
$select_text = get_text_for_select_based_on_attribute($args['attribute']);
$args = wp_parse_args( $args, array(
'options' => false,
'attribute' => false,
'product' => false,
'selected' => false,
'name' => '',
'id' => '',
'class' => '',
'show_option_none' => __( $select_text, 'woocommerce' ),
'show_option_color' => __( 'Choose a color', 'woocommerce' ),
'show_option_size' => __( 'Choose a size', 'woocommerce' )
) );
$options = $args['options'];
$product = $args['product'];
$attribute = $args['attribute'];
$name = $args['name'] ? $args['name'] : 'attribute_' . sanitize_title( $attribute );
$id = $args['id'] ? $args['id'] : sanitize_title( $attribute );
$class = $args['class'];
if ( empty( $options ) && ! empty( $product ) && ! empty( $attribute ) ) {
$attributes = $product->get_variation_attributes();
$options = $attributes[ $attribute ];
}
$html = '
if ( $args['show_option_none'] ) {
$html .= '' . esc_html( $args['show_option_none'] ) . '';
}
if ( ! empty( $options ) ) {
if ( $product && taxonomy_exists( $attribute ) ) {
// Get terms if this is a taxonomy - ordered. We need the names too.
$terms = wc_get_product_terms( $product->id, $attribute, array( 'fields' => 'all' ) );
foreach ( $terms as $term ) {
if ( in_array( $term->slug, $options ) ) {
$html .= 'slug ) . '" ' . selected( sanitize_title( $args['selected'] ), $term->slug, false ) . '>' . esc_html( apply_filters( 'woocommerce_variation_option_name', $term->name ) ) . '';
}
}
} else {
foreach ( $options as $option ) {
// This handles < 2.4.0 bw compatibility where text attributes were not sanitized.
$selected = sanitize_title( $args['selected'] ) === $args['selected'] ? selected( $args['selected'], sanitize_title( $option ), false ) : selected( $args['selected'], $option, false );
$html .= '' . esc_html( apply_filters( 'woocommerce_variation_option_name', $option ) ) . '';
}
}
}
$html .= '';
echo apply_filters( 'woocommerce_dropdown_variation_attribute_options_html', $html, $args );
}

Source: http://stackoverflow.com/questions/32170575/how-do-i-change-button-text-from-choose-an-option-in-woocommerce