Luc
Luc

Reputation: 1825

woocommerce - get total cart price excluding tax

I'm using Woocommerce for Wordpress to build a webshop.

In the checkout, I want to include the total price excl tax. How do I do this? I've found things like 'get_total_ex_tax()', but it doesn't work. Maybe i'm formatting it wrong, or in the wrong place or something. Does anyone have an idea?

Thanks!

Upvotes: 0

Views: 9397

Answers (1)

sabarnix
sabarnix

Reputation: 775

This is the code to show total excluding tax before tax is displayed

add_action( 'woocommerce_review_order_after_shipping', 'output_total_excluding_tax' );
function output_total_excluding_tax() {
  ?>
  <tr class="total_ex_tax">
    <th>Total Excluding Tax</th>
    <td><?php echo WC()->cart->get_total_ex_tax(); ?></td>
  </tr>
  <?php
}

Upvotes: 3

Related Questions