Hi,
Remove the last code and use this code:-
add_filter( 'woocommerce_product_categories_widget_dropdown_args', 'rv_exclude_wc_widget_categories');
add_filter( 'woocommerce_product_categories_widget_args', 'wpsites_exclude_product_cat_widget' ,99 );
function wpsites_exclude_product_cat_widget( $args ) {
$args['exclude'] = array('153','157','158','159','160','161'); // MUST CHNAGE THE ID OF CATEGORIES HERE
return $args;
}
Thanks
Mohammad