Tento BCM | Site Banner Q2 2025

Product Icon

WooCommerce

Sell online with the flexible, customizable eCommerce platform designed to grow with your business. From your first sale to millions in revenue, Woo is with you. See why merchants trust us to power 3.4 million online stores.

Brand Filter in Product List – Backoffice

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’ );

Author

dlerias

Current Status

Open

Last updated: May 8, 2025

0 comments

Log in to comment on this feature request.