fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Remove “choose an option” text on variations

Hello, I want to remove the line “choose and option” from the select field of our variations. We dont see the meaning of this field when we have set a deafult value on each product.

Is there a way?

 

On this site: https://rubn.com/product/monroe-floor/

Cheers,

Hakik Zaman

Hi mikael,

Thanks for reaching out to us. It is the basic behavior of WooCommerce.

BTW, you can 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;
}

Please add the above code to your child theme’s functions.php or use add as a snippet using the Code Snippets plugin.

Thank You