自定义 Woocommerce 客户电子邮件通知中的总计行
Customizing totals lines in Woocommerce customer email notifications
我的 woocommerce 按预期发送了一个。
税务字段如何显示似乎未关闭的标签。
我已经搜索了整个 woocommerce 代码,但找不到标签的生成位置。
这是我的税务字段在电子邮件中的样子。
Total: DKK 0.00 <small class="includes_tax"
This can only be the result of a customization that you have made on order totals, or that your theme or a plugin is making. By default there is no such behavior in Woocommerce. It seems in your case due to a plugin (or some customizations) that displays the currency symbol as a Code.
现在 Woocommerce 电子邮件通知中的订单总计行是使用 WC_Order
方法生成的 get_order_item_totals()
然后您可以使用以下代码对其进行更改:
add_filter( 'woocommerce_get_order_item_totals', 'customize_order_line_totals', 1000, 3 );
function customize_order_line_totals( $total_rows, $order, $tax_display ){
// Only on emails notifications
if( ! is_wc_endpoint_url() || ! is_admin() ) {
// Remove any other html tags from gran total value
$total_rows['order_total']['value'] = strip_tags( wc_price( $order->get_total() ) );
}
return $total_rows;
}
代码进入您的活动子主题(或活动主题)的 function.php 文件。它应该可以解决您的问题。
但最好的方法应该是找出罪魁祸首,而不是修补某个地方的某些自定义错误。
我的 woocommerce 按预期发送了一个。
税务字段如何显示似乎未关闭的标签。
我已经搜索了整个 woocommerce 代码,但找不到标签的生成位置。
这是我的税务字段在电子邮件中的样子。
Total: DKK 0.00 <small class="includes_tax"
This can only be the result of a customization that you have made on order totals, or that your theme or a plugin is making. By default there is no such behavior in Woocommerce. It seems in your case due to a plugin (or some customizations) that displays the currency symbol as a Code.
现在 Woocommerce 电子邮件通知中的订单总计行是使用 WC_Order
方法生成的 get_order_item_totals()
然后您可以使用以下代码对其进行更改:
add_filter( 'woocommerce_get_order_item_totals', 'customize_order_line_totals', 1000, 3 );
function customize_order_line_totals( $total_rows, $order, $tax_display ){
// Only on emails notifications
if( ! is_wc_endpoint_url() || ! is_admin() ) {
// Remove any other html tags from gran total value
$total_rows['order_total']['value'] = strip_tags( wc_price( $order->get_total() ) );
}
return $total_rows;
}
代码进入您的活动子主题(或活动主题)的 function.php 文件。它应该可以解决您的问题。
但最好的方法应该是找出罪魁祸首,而不是修补某个地方的某些自定义错误。