New Landing How can we help? Themeforest Theme Support Neighborhood How to override a function in woocommerce ?

Viewing 2 posts - 1 through 2 (of 2 total)
  • #110308
    librairiesel
    Member
    Post count: 45

    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

    #110458
    laranz – SUPPORT
    Member
    Post count: 3186

    Hi,

    You can try some ways to extend the woocommerce core classes instead editing it directly in the source, you may ask help here http://wordpress.org/support/plugin/woocommerce

    Let us know,

    Thanks,
    laranz.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register