Hide cat-parent class when category will show no children due to depth setting
Closes #17184
This commit is contained in:
parent
feffde2a73
commit
8fa6116ef6
|
@ -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';
|
||||
}
|
||||
|
||||
|
|
|
@ -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">';
|
||||
|
||||
|
|
Loading…
Reference in New Issue