gpt4 book ai didi

php - 显示小计不包括。税,在 Woocommerce 结帐时将小计税添加为单独的行

转载 作者:搜寻专家 更新时间:2023-10-31 21:20:09 26 4
gpt4 key购买 nike

目前我的所有产品都设置为含税。由于我所在国家/地区的规定,我希望我的小计不含税,然后是要支付的税额,然后是所有税金的总计(这已经是默认值)

在我的 review-order.php 这一行 <td><?php wc_cart_totals_subtotal_html(); ?></td>被调用。我想从中减去税率 (21%) (/121 * 100)。然后是一个显示完整税额的新行(总计 - 小计)。

最佳答案

更新:首先,对于信息,woocommerce 模板是 overridden via your active theme .

将模板 checkout/review-order.php 复制到主题中的“woocommerce”子文件夹后(如上面的链接文档所述),打开/编辑此模板并替换以下代码块(第 58 至 61 行):

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

通过这个代码块:

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

它将为您提供不含税的小计,并在附加行中提供小计税额......

enter image description here

关于php - 显示小计不包括。税,在 Woocommerce 结帐时将小计税添加为单独的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53872130/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com