Hide cat-parent class when category will show no children due to depth setting

Closes #17184
This commit is contained in:
Mike Jolley 2017-10-13 12:50:49 +01:00
parent feffde2a73
commit 8fa6116ef6
2 changed files with 2 additions and 1 deletions

View File

@ -92,7 +92,7 @@ class WC_Product_Cat_List_Walker extends Walker {
$output .= ' current-cat';
}
if ( $args['has_children'] && $args['hierarchical'] ) {
if ( $args['has_children'] && $args['hierarchical'] && ( empty( $args['max_depth'] ) || $args['max_depth'] > $depth + 1 ) ) {
$output .= ' cat-parent';
}

View File

@ -246,6 +246,7 @@ class WC_Widget_Product_Categories extends WC_Widget {
$list_args['show_option_none'] = __( 'No product categories exist.', 'woocommerce' );
$list_args['current_category'] = ( $this->current_cat ) ? $this->current_cat->term_id : '';
$list_args['current_category_ancestors'] = $this->cat_ancestors;
$list_args['max_depth'] = $max_depth;
echo '<ul class="product-categories">';