Hi,
I would like to override a function in woocommerce :
/wp-content/plugins/woocommerce/includes/walkers/class-product-cat-list-walker.php
In this file I just want to replace a few lines (I can’t do it in CSS, so I suppose I have to use the functions.php in my child-theme).
Between the lines 75 to 79, here is the code :
$output .= '"><a href="' . get_term_link( (int) $cat->term_id, 'product_cat' ) . '">' . __( $cat->name, 'woocommerce' ) . '</a>';
if ( $args['show_count'] ) {
$output .= ' <span class="count">(' . $cat->count . ')</span>';
}
and I want to change it to :
if ( $args['show_count'] ) {
$output .= '"><a href="' . get_term_link( (int) $cat->term_id, 'product_cat' ) . '">' . __( $cat->name, 'woocommerce' ) . '<span class="count">' . $cat->count . '</span></a>';
}else{
$output .= '"><a href="' . get_term_link( (int) $cat->term_id, 'product_cat' ) . '">' . __( $cat->name, 'woocommerce' ) . '</a>';
}
I’ve been searching for hours but I don’t manage to find how to override these lines.
I tried with filters, but I’m not a codex expert. So I defer to you.
Thanks