Hi Krystyna,
Thanks for reaching out to us. It is the default behavior of WooCommerce. By the way, try the below code-
add_filter( 'wvs_variation_attribute_options_html', 'filter_dropdown_option_html', 12, 4 );
function filter_dropdown_option_html( $data, $args, $is_default_to_image, $is_default_to_button ) {
$show_option_none_text = $args['show_option_none'] ? $args['show_option_none'] : __( 'Choose an option', 'woocommerce' );
$show_option_none_html = '<option value="">' . esc_html( $show_option_none_text ) . '</option>';
$data = str_replace($show_option_none_html, '', $data);
return $data;
}
Thank You
remove choose option from select box
Krystyna Pelczarska
i just want to have my attribute values and remove ” choose option” tried this code in function:
add_filter( 'woocommerce_dropdown_variation_attribute_options_html', 'filter_dropdown_option_html', 12, 2 );
function filter_dropdown_option_html( $html, $args ) {
$show_option_none_text = $args['show_option_none'] ? $args['show_option_none'] : ( 'Choose an option', 'woocommerce' );
$show_option_none_html = '<option value="">' . esc_html( $show_option_none_text ) . '</option>';
$html = str_replace($show_option_none_html, '', $html);
return $html;
}