WooCommerce: Display Custom Filters @ WP Dashboard > Products

If you go to WordPress Dashboard > Products you will find default product admin filters such as “Select a category”, “Filter by product type”, “Filter by stock status”. What if you want to add more custom filters to let your shop managers find products easily?

For example, you could add “Filter by product tag” (“product tags” are one of the two default WooCommerce “taxonomies” together with “product categories”). Or, if you use custom taxonomies such as product brands, you could add a “Filter by product brand” dropdown.

Thankfully this is super easy – and here comes the proof 🙂

Adding custom admin product filters in WooCommerce

PHP Snippet: Add Custom Filter e.g. Product Tag @ WooCommerce Products Admin Dashboard

/**
 * @snippet       Custom Filter @ WooCommerce Products Admin
 * @how-to        businessbloomer.com/woocommerce-customization
 * @author        Rodolfo Melogli, Business Bloomer
 * @compatible    WooCommerce 8
 * @community     https://businessbloomer.com/club/
 */ 

add_filter( 'woocommerce_product_filters', 'bbloomer_filter_by_custom_taxonomy_dashboard_products' );

function bbloomer_filter_by_custom_taxonomy_dashboard_products( $output ) {

  global $wp_query;

  $output .= wc_product_dropdown_categories( array(
	'show_option_none' => 'Filter by product tag',
	'taxonomy' => 'product_tag',
	'name' => 'product_tag',
	'selected' => isset( $wp_query->query_vars['product_tag'] ) ? $wp_query->query_vars['product_tag'] : '',
  ) );

  return $output;
}

Where to add custom code?

You should place custom PHP in functions.php and custom CSS in style.css of your child theme: where to place WooCommerce customization?

This code still works, unless you report otherwise. To exclude conflicts, temporarily switch to the Storefront theme, disable all plugins except WooCommerce, and test the snippet again: WooCommerce troubleshooting 101

Related content

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

44 thoughts on “WooCommerce: Display Custom Filters @ WP Dashboard > Products

  1. Sorry the code works however thanks a lot. I have one question can the same code be used to filter taxonomy e.g. colour or size ?

    thanks

    1. Hey Martin, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  2. Hi I pasted this code in woocommerce 8 but in the dashboard it only shows filters and does not filter them can someone help with the code

    thank you

    1. Hi Martin, another reader just said it works perfectly, so you probably have a plugin or theme conflict. To troubleshoot, disable all plugins but WooCommerce and also switch temporarily to “Twentytwenty” theme (load the snippet there in functions.php) as explained here: https://www.businessbloomer.com/lesson/trwm4l01/

      Once you do that, does it work? If yes, you have a problem with your current theme or one of the plugins.

      Hope this helps!

      1. Thanks for the reply. Unfortunately I checked by disabling all plugins and switched to the default twenty-twenty theme and the code unfortunately does not filter anymore.

        1. From your latest comment I see this works, so please let me know what the problem was. PHP version? Object cache?

      2. I too am having an issue with PHP Snippet: Add Custom Taxonomy Filter @ WooCommerce Products Admin Dashboard (Filter by product Tag). Woo 8.0.3 and WP 6.3.1. The filter box does not display any longer. (It used to). I disabled all plugins except Woocommerce and it still did not show the filter by tag in the Admin -> Products section.

        1. Works perfectly here (Woo 8.0.3 and WP 6.3.1.). I’m on PHP 7.4, not sure if that’s the reason in case you’re on PHP 8. Also, please try to clear all your caches and try again. Let me know!

  3. Still works perfectly. Thanks for sharing. This is really helpful!

  4. Works!
    Tested with WP5.9.1 and WC6.2.0

    Thanks

  5. Not showing products with draft status 🙁 Can you help me to also show products with status “Draft”?

    1. Hi Levskyy! Sorry, don’t you already have a text link for “All | Published | Drafts” products, above the filters?

  6. This tag filter snippet is perfect for what we were looking for. It worked great, until the most recent WP/Woocommerce updates in the last week(s). Now the drop-down for “Filter by Product Tag” is showing the correct tags, but showing “0” for the numbers for each tag (eventhough there are plenty of products with those tags). Also, filtering no longer works. So something likely has changed with a recent Woocommerce update?

    Would love to use the updated version of this script when it becomes available.

    1. Hi Ernest, thanks for your comment! I just tested this again with Storefront theme and it works perfectly. Maybe your theme (or another plugin) is messing/conflicting with my snippet.

      To troubleshoot, disable all plugins but WooCommerce and also switch temporarily to “Twentytwenty” theme (load the snippet there in functions.php) as explained here: https://www.businessbloomer.com/lesson/trwm4l01/

      Once you do that, does it work? If yes, you have a problem with your current theme or one of the plugins.

      Hope this helps!

  7. Hello,

    What about if I want to filter products by other attributes, like weight and L/W/H(Dimensions ) please?

    Thanks, and have a nice day.

    1. Alex, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  8. A little side note. Implementing this snippet will cause most other filters to disappear..

    1. Did you use the exact same code?

  9. Great article as usual.
    Not sure if this is custom work or not, but is it possible to easily implement a “opposite” filter like is NOT in term?

    1. Yes, it is custom work I’m afraid. Get in touch if needed! Thank you

  10. Hello Rodolfo! First of all thank you for all the help you provide for free!
    Do you know how to configure WooCommerce to sum the total quantity of the products in the ADMIN order page? PLEASE HELP

    1. Hi Gabriel, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  11. It worked great and used the code also to filter by product attribute, amazing thanks

    1. Awesome!

  12. Hi,
    It very useful but I need to filter The admin products using Product SKU Is it possible . please let me know how to do this . Thank you

    1. Hi Nirmal, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  13. Thanks you so much for this custom filter. Is there anyway to filter product tag by typeahead like category filter ?

    1. Hi Steven, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!

  14. Good solution. Simple and effective.
    Do not have any solutions – that you can share – identically, but for products variation search on order pages?
    Thanks in advance.

    1. Thank you – no I don’t at the moment!

  15. Hi bro. How can I filter none-tag products ? I have many products without tags and I want to filter them for adding tags but I dont know how…

    1. Hi bro. Try using the existing sort buttons.

  16. Hi, Im trying to do the same wth coupons; I want to either filter them by usage_limit_per_user, or sort them by usage_limit_per_user.
    I tried using your code and modified it, but no luck yet.
    https://github.com/schalkjoubert/wc-coupon-filter/blob/master/function

    Will be super if it is possible to fix easily.
    Thank you

    1. Hello Schalk, thanks so much for your comment! Yes, this is possible – unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R

  17. Man, you save my day.
    Used with product_brand and voila — all working. Thanks!!

    1. Excellent!

  18. Hello,

    how can we apply this to product status? as anyone knows, when you sort the products, you also see the pending or drafts, and it is very inconvenient. It will be better if on sorting you can only see the published!

    thanks

    1. Hey Perusi, thanks so much for your comment! Yes, this is possible – unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R

  19. Hi,
    Thank you for a great article. But actually what I want is to filter products in admin page by tax class. Is that possible? And how to do that? Please help.

    1. Hello John, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding! ~R

  20. It worked perfect!
    Can I add more filters? Something like store or taxes?
    Thank you very much!

    1. Hey there – thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R

Questions? Feedback? Customization? Leave your comment now!
_____

If you are writing code, please wrap it like so: [php]code_here[/php]. Failure to complying with this, as well as going off topic or not using the English language will result in comment disapproval. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining the Business Bloomer Club to get quick WooCommerce support. Thank you!

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