Viewing 1 replies (of 1 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi mysteries800,

    you can sum products subtotals, and print total where you want in template

    For example, after that you overwrite wishlist-view.php template, you can add a $total inizialization, at line 124 and increase it at each iteration of the foreach cycle (line 136)

    <?php
        $total = 0;
        if( count( $wishlist_items ) > 0 ) :
            foreach( $wishlist_items as $item ) :
                global $product;
                if( function_exists( 'wc_get_product' ) ) {
                    $product = wc_get_product( $item['prod_id'] );
                }
                else{
                    $product = get_product( $item['prod_id'] );
                }
    
                if( $product !== false && $product->exists() ) :
                $total += (double) $product->get_price();
                $availability = $product->get_availability();
                $stock_status = $availability['class'];

    Now you can print $total were you wish; for example, I’ve added it in the tfoot tag

    <tfoot>
        <tr>
            <td colspan="<?php echo esc_attr( $column_count ) ?>">
                <p class="total"><span>Total:</span> <?php echo wc_price( $total )?></p>

    This is an example of the final result (includes also category column of the previous post)

    Let me know if this helps
    Have a nice day!

Viewing 1 replies (of 1 total)
  • The topic ‘Sub-total below items list’ is closed to new replies.