Change the "Choose an Option" Text
Replaces the placeholder in variation dropdowns with a clearer prompt that names the attribute, such as "Select a size".
Opens WPIDE on
Code
add_filter( 'woocommerce_dropdown_variation_attribute_options_args', function ( $args ) {
if ( ! empty( $args['attribute'] ) ) {
$args['show_option_none'] = sprintf( 'Select a %s', strtolower( wc_attribute_label( $args['attribute'], $args['product'] ?? '' ) ) );
}
return $args;
} );
Notes
""
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.