[英]Customizing totals lines in Woocommerce customer email notifications
My woocommerce sends out an as it is suppose to.我的 woocommerce 发出了它应该的。
How ever the tax fields shows up with what seems to be an unclosed tag.税收字段如何显示似乎是未关闭的标签。
I have grepped thru the entire woocommerce code, but I cant find where the tags are generated.我已经浏览了整个 woocommerce 代码,但找不到标签的生成位置。
this is how my tax field looks in the email.这就是我的税务字段在电子邮件中的外观。
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.
默认情况下,Woocommerce 中没有这种行为。 It seems in your case due to a plugin (or some customizations) that displays the currency symbol as a Code .
在您的情况下,这似乎是由于插件(或某些自定义)将货币符号显示为 Code 。
Now order totals rows in Woocommerce email notifications are generated using the WC_Order
method get_order_item_totals()
现在 Woocommerce 电子邮件通知中的订单总计行是使用
WC_Order
方法get_order_item_totals()
Then you can make changes in it using the following code:然后您可以使用以下代码对其进行更改:
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;
}
Code goes in function.php file of your active child theme (or active theme).代码位于活动子主题(或活动主题)的 function.php 文件中。 It should solve your problem.
它应该可以解决您的问题。
But the best way should be to find out the guilty, instead of patching something wrong done by some customization somewhere.但最好的方法应该是找出有罪的,而不是修补某个地方的某些自定义所做的错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.