php - 从确认邮件 woocommerce 中删除小计
问题描述
我想从 woocommerce 新订单邮件中删除总计和小计。此代码适用于总计,但仍显示小计。
add_filter( 'woocommerce_get_order_item_totals', 'reordering_order_item_totals', 10, 3 );
function reordering_order_item_totals( $total_rows, $order, $tax_display ){
$shipping = $total_rows['line_subtotal'];
$order_total = $total_rows['order_total'];
unset($total_rows['line_subtotal']);
unset($total_rows['order_total']);
return $total_rows;
}
我试过了['line_subtotal']
,你知道它的名字吗['order_subtotal']
?['subtotal']
十分感谢
解决方案
请在functions.php文件中尝试以下代码
add_filter( 'woocommerce_get_order_item_totals', 'reordering_order_item_totals', 10, 3 );
function reordering_order_item_totals( $total_rows, $order, $tax_display ){
$shipping = $total_rows['cart_subtotal'];
$order_total = $total_rows['order_total'];
unset($total_rows['cart_subtotal']);
unset($total_rows['order_total']);
return $total_rows;
}
推荐阅读
- reinforcement-learning - 强化学习:如何使用模拟器创建新的游戏环境
- c - 带有子文件夹和几个 .c 文件的 C makefile(错误。ld)
- c# - 如何使用 Unity 在 ARKit 中隐藏用于平面检测的平面预制件?
- powershell - 受域保护的 pfx 需要什么密码?
- nativescript - NativeScript 在页面标签上添加 xml 命名空间
- javascript - 打字稿:按值检查对象是否存在于数组中
- java - HashMap 在内部检查两个键是否相等,使用的是哪种算法?
- javascript - 我需要在角度翻译中翻译一个动态变量
- xml - XML - XSLT 按计数分组元素
- node.js - TypeError: Request path contains unescaped characters at googleapis