从Woocommerce中的购物车和结帐页面中删除小计行
- WooCommerce
- 2021-11-27
- 270热度
- 0评论
1、删除所有订单页面和电子邮件通知 (已收到订单,订单付款,订单视图和电子邮件)
将以下代码添加到主题的function.php文件中,经过测试并有效。
add_filter( 'woocommerce_get_order_item_totals', 'remove_subtotal_from_orders_total_lines', 100, 1 );
function remove_subtotal_from_orders_total_lines( $totals ) {
unset($totals['cart_subtotal'] );
return $totals;
}
2、对于购物车和结帐页面:
在主题目录下创建一个" woocommerce"文件夹
删除购物车小计行:cart/cart-totals.php |在30行左右删除以下代码
<tr class="cart-subtotal">
<th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
<td data-title="<?php esc_attr_e( 'Subtotal', 'woocommerce' ); ?>"><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
删除结帐部分小行- checkout/review-order.php |删除代码行从55行左右删除一下代码
<tr class="cart-subtotal">
<th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
<td><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
