woocommerce choose an option code example

Example: woocommerce remove choose an option from dropdown

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_text = esc_html( $show_option_none_text );

    $html = str_replace($show_option_none_text, '', $html);

    return $html;
}

Tags:

Misc Example