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 🙂
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;
}
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
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!
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
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!
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.
From your latest comment I see this works, so please let me know what the problem was. PHP version? Object cache?
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.
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!
Still works perfectly. Thanks for sharing. This is really helpful!
You’re welcome!
Works!
Tested with WP5.9.1 and WC6.2.0
Thanks
Awesome
Not showing products with draft status 🙁 Can you help me to also show products with status “Draft”?
Hi Levskyy! Sorry, don’t you already have a text link for “All | Published | Drafts” products, above the filters?
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.
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!
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.
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!
A little side note. Implementing this snippet will cause most other filters to disappear..
Did you use the exact same code?
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?
Yes, it is custom work I’m afraid. Get in touch if needed! Thank you
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
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!
It worked great and used the code also to filter by product attribute, amazing thanks
Awesome!
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
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!
Thanks you so much for this custom filter. Is there anyway to filter product tag by typeahead like category filter ?
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!
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.
Thank you – no I don’t at the moment!
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…
Hi bro. Try using the existing sort buttons.
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
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
Man, you save my day.
Used with product_brand and voila — all working. Thanks!!
Excellent!
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
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
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.
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
It worked perfect!
Can I add more filters? Something like store or taxes?
Thank you very much!
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