显示小计的总和.税,在Woocommerce结帐时将小计税添加为单独的行 [英] Show subtotal excl. tax, add subtotal tax as separate row on Woocommerce checkout

查看:51
本文介绍了显示小计的总和.税,在Woocommerce结帐时将小计税添加为单独的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我将所有产品都设置为含税.由于我所在国家/地区的规定,我希望小计免税,然后是要支付税额的行,然后是所有税项的合计(已经是默认值)

在我的review-order.php行中< td><?php wc_cart_totals_subtotal_html();?></td> 被叫.我想从中减去税率(21%)(/121 * 100).然后在新行中显示全部税额(总计-小计).

解决方案

已更新:首先,为了获取信息,将woocommerce模板制作为

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).

解决方案

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…

这篇关于显示小计的总和.税,在Woocommerce结帐时将小计税添加为单独的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆