To change the "Select option" to "Select Location" text in Woo-commerce variable.
when you have more than 1 variable with different text.
add_filter('woocommerce_dropdown_variation_attribute_options_args', 'custom_woocommerce_product_add_to_cart_text', 10, 1);
function custom_woocommerce_product_add_to_cart_text($args){
$args['show_option_none'] = __( 'Select Location', 'woocommerce' );
return $args;
}
Variations
From: Select Color
To: Select Size
Time: Select Length
You can check for the attribute, and change the text accordingly
function custom_woocommerce_product_add_to_cart_text ($args) {
// Args attribute
$attribute = $args['attribute'];
if ( $attribute == 'From' ) {
$args['show_option_none'] = __( 'Select Color', 'woocommerce' );
} elseif ( $attribute == 'To' ) {
$args['show_option_none'] = __( 'Select Size', 'woocommerce' );
} elseif ( $attribute == 'Time' ) {
$args['show_option_none'] = __( 'Select length', 'woocommerce' );
} else {
$args['show_option_none'] = __( 'Default', 'woocommerce' );
}
return $args;
}
add_filter('woocommerce_dropdown_variation_attribute_options_args', 'custom_woocommerce_product_add_to_cart_text', 10, 1 );