简体   繁体   English

在 Woocommerce 客户电子邮件通知中自定义总计行

[英]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.

相关问题 重新排列 WooCommerce 电子邮件通知中的订单详细信息总数 - Rearrange order detail totals on WooCommerce email notifications 在 Woocommerce 电子邮件通知中显示订单客户备注 - Display order customer note in Woocommerce email notifications 在Woocommerce电子邮件通知中编辑客户详细信息 - Edit customer details in Woocommerce email notifications 在 WooCommerce email 通知中重新订购客户详细信息 - Reorder customer details in WooCommerce email notifications 在Woocommerce 3中的客户电子邮件通知上设置跟踪编号链接 - Set a Tracking Number link on customer email notifications in Woocommerce 3 根据 Woocommerce 中的运输方式向客户通知添加回复电子邮件 - Add a reply email to customer notifications based on shipping methods in Woocommerce 在 WooCommerce email 通知中将发件人名称更改为客户账单全名 - Change sender name to customer billing full name in WooCommerce email notifications 定位WooCommerce客户处理和完成的订单电子邮件通知 - Targetting WooCommerce customer processing and completed order email notifications 在“新订单” Woocommerce电子邮件通知中显示客户电话 - Display customer phone in “New Order” Woocommerce email notifications 在客户详细信息之后 WooCommerce 普通电子邮件通知有什么钩子? - What hook for WooCommerce plain email notifications after customer details?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM