This is a basic feature i don’t know how is not implemented with a standar instalation of woocommerce.
I’m going to share my custom code to bypass this lack of filter, maybe in the next release you guys can put it in… Thanks.
// Add Brand Filter to Admin Product List
function add_brand_filter_to_admin_products() {
global $typenow;
if ( $typenow == ‘product’ ) {
$taxonomy = ‘brand’;
$brand_taxonomy = get_taxonomy( $taxonomy );
wp_dropdown_categories( array(
‘show_option_all’ => __( ‘Todas as marcas’, ‘text_domain’ ),
‘taxonomy’ => $taxonomy,
‘name’ => $taxonomy,
‘orderby’ => ‘name’,
‘selected’ => isset( $_GET[$taxonomy] ) ? $_GET[$taxonomy] : ”,
‘hierarchical’ => true,
‘show_count’ => true,
‘hide_empty’ => true,
));
}
}
add_action( ‘restrict_manage_posts’, ‘add_brand_filter_to_admin_products’ );
// Filter products by brand in admin
function filter_products_by_brand_in_admin( $query ) {
global $pagenow;
$taxonomy = ‘brand’;
$q_vars = &$query->query_vars;
if ( $pagenow == ‘edit.php’ && isset( $q_vars[‘post_type’] ) && $q_vars[‘post_type’] == ‘product’ && isset( $_GET[$taxonomy] ) && is_numeric( $_GET[$taxonomy] ) && $_GET[$taxonomy] != 0 ) {
$term = get_term_by( ‘id’, $_GET[$taxonomy], $taxonomy );
$q_vars[$taxonomy] = $term->slug;
}
}
add_filter( ‘parse_query’, ‘filter_products_by_brand_in_admin’ );
Open
Last updated: May 8, 2025
0 comments
Log in to comment on this feature request.