Last active
August 29, 2015 14:06
-
-
Save croosen/83ce8a3bc8ee520eb7ba to your computer and use it in GitHub Desktop.
WooCommerce - Show all subcategories in product category / archive pages - even when empty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$args = apply_filters( 'woocommerce_product_subcategories_args', array( | |
'parent' => $parent_id, | |
'menu_order' => 'ASC', | |
'hide_empty' => 0, | |
'hierarchical' => 1, | |
'taxonomy' => 'product_cat', | |
'pad_counts' => 1 | |
) ); | |
// Update: Use this in your functions.php: | |
add_filter('woocommerce_product_subcategories_args', 'woocommerce_show_empty_categories'); | |
function woocommerce_show_empty_categories($args){ | |
$args['hide_empty']=0; | |
return $args; | |
} |
D'oh! :-) Just use this in your funcions.php:
add_filter('woocommerce_product_subcategories_args', 'woocommerce_show_empty_categories');
function woocommerce_show_empty_categories($args){
$args['hide_empty']=0;
return $args;
}
Hi!
Is it possible to HIDE a specific category or subcategory from the whole shop using woocommerce_product_subcategories_args?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
By default, "hide_empty" was set to 1, preventing empty sub/child categories to be displayed. I needed a fully click through catalog (click from parent to > sub > sub > sub even when empty) and therefore had to set this setting to 0. Not best practice to do this in core files, may want to find a better way to override it.