6

Currently I have all my products set to include tax. Because of rules in my country I would like to have my subtotal without tax, then a line with the amount of tax being paid and then the total with all the taxes (which is already default)

In my review-order.php the line <td><?php wc_cart_totals_subtotal_html(); ?></td> gets called. I would like to subtract the tax percentage (21%) from that so ( / 121 * 100). And then a new line which shows the full tax amount so (total - subtotal).

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
IsaacGluton
  • 75
  • 1
  • 1
  • 5

2 Answers2

3

Updated: First, for info, woocommerce templates are made to be overridden via your active theme.

Once you have copied the template checkout/review-order.php to the "woocommerce" subfolder located in your theme (as explained on the linked documentation above), open/edit this template and replace the following code block (line 58 to 61):

<tr class="cart-subtotal">
    <th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
    <td><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>

By this code bloc:

<tr class="cart-subtotal">
    <th><?php printf( __( 'Subtotal %s', 'woocommerce' ), '<small>(excl. tax)<small>' );?></th>
    <td><?php echo wc_price( WC()->cart->get_subtotal() ); ?></td>
</tr>

<tr class="cart-subtotal-tax">
    <th><?php _e( 'Subtotal tax', 'woocommerce' ); ?></th>
    <td><?php echo wc_price( WC()->cart->get_subtotal_tax() ); ?></td>
</tr>

It will give you the subtotal without taxes and on an additional line the subtotal tax amount…

enter image description here

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
  • i didn't need to try this solution, because the alternate solution presented by @markmoxx achieved the same results just by changing one simple woocommerce setting -in woocommerce > settings > tax. Seems a bit unnecessary to add a php function for it. – bonzo46 Jul 06 '19 at 04:01
1

Go to your Tax options in WC settings and ensure the Prices entered with tax option is set to 'Yes, I will enter prices inclusive of tax.'

Change Display prices during cart and checkout option from 'Including tax' to 'Excluding tax'.

That should help you achieve what you want without using any code.

markmoxx
  • 1,492
  • 1
  • 11
  • 21
  • Thanks for this. I needed to display UK VAT as a separate line item on the checkout and order confirmation and item prices EX VAT - but on the product pages I show prices including VAT. Thank you - nice simple solution without having to add php functions. – bonzo46 Jul 06 '19 at 03:57
  • 1
    BTW the setting is under woocommerce > settings > tax – bonzo46 Jul 06 '19 at 04:03