[2.5] Fix 'hide empty' setting in category widget

Fixes #10213
This commit is contained in:
Mike Jolley 2016-01-29 11:43:52 +00:00
parent 25e02ac6f1
commit 9dea16ab6c
2 changed files with 2 additions and 2 deletions

View File

@ -92,7 +92,7 @@ class WC_Product_Cat_Dropdown_Walker extends Walker {
* @return null Null on failure with no changes to parameters.
*/
public function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
if ( ! $element || 0 === $element->count ) {
if ( ! $element || ( 0 === $element->count && ! empty( $args['hide_empty'] ) ) ) {
return;
}
parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );

View File

@ -138,7 +138,7 @@ class WC_Product_Cat_List_Walker extends Walker {
* @return null Null on failure with no changes to parameters.
*/
public function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
if ( ! $element || 0 === $element->count ) {
if ( ! $element || ( 0 === $element->count && ! empty( $args['hide_empty'] ) ) ) {
return;
}
parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );