• Hi, I’m trying to remove all unnecessary visual information. The sub-total on my site (fyi, on localhost only, no URL) shows even when it’s the same as the final order total. It’s duplication, as coupons and taxes aren’t used. How can the php file with the sub-total be amended to only display, if the $ figure is different to the final order-total? Thanks!

    This is on both the cart and checkout screens.

    https://www.ads-software.com/plugins/woocommerce/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Check out the WC_Cart class.

    $subtotal = WC()->cart->get_cart_subtotal(true);
    $total = WC()->cart->get_cart_total();

    In cart-total.php, you will need an if statement to compare the two around lines 20 -24 which output the sub-total.

    Also in review-order.php, lines 50 – 53.

    Not tested!

    Thread Starter Waup

    (@mm-blog)

    Thanks Lorro! Not quite sure how to do If statements… something to learn ??

    if ( $subtotal == $total ) {
      // output the sub-total here
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to only show sub-total if different to order total?’ is closed to new replies.