简体   繁体   中英

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!

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
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM