WooCommerce : Add Custom Taxonomy Filter on Products Dashboard

When we go to WordPress Dashboard > Products. We see Many Product filters such as “Select a category”, “Filter by product type”, “Filter by stock status”.
For Adding More filters as our requirements. like Product tags.

function CustomTaxonomyFilter( $data ) {
  global $wp_query;
  $data .= wc_product_dropdown_categories( array(
    'show_option_none' => 'Filter by Tags',
    'taxonomy' => 'product_tag',
    'name' => 'product_tag',
    'selected' => isset( $wp_query->query_vars['product_tag'] ) ? $wp_query->query_vars['product_tag'] : '',
) );
return $data;
}
add_filter( 'woocommerce_product_filters', 'CustomTaxonomyFilter' );

//output
null

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top