• tommyqr

    (@tommyqr)


    I created a copy of YITH Woocommerce Compare compare.php and added the following code before <tr in line 116)

    <?php
    $show_field = 0;
    foreach( $products as $i => $product ) :
        if( ! empty( $product->fields[$field] ) ) {
            $show_field = 1;
        }
    endforeach;
    
    if( $show_field == 1 ) : ?>

    and put <?php
    $show_field = 0;
    foreach( $products as $i => $product ) :
    if( ! empty( $product->fields[$field] ) ) {
    $show_field = 1;
    }
    endforeach;

    if( $show_field == 1 ) : ?>
    after </tr> in line 143

    It does not hide blank fields in the comparison.

    I thought the above code would work? I cannot see why it doesn’t.

  • The topic ‘Hide empty fields in YITH Woocommerce Product Plugin’ is closed to new replies.