自定义Woocommerce客户邮件通知中的总计行。

问题描述 投票:1回答:1

我的woocommerce发送了一个它应该是。

税务字段如何显示出似乎是一个未关闭的标签。

我已经浏览了整个woocommerce的代码,但我找不到标签的生成位置。

这是我的税务字段在电子邮件中的样子。

 Total:     DKK 0.00 <small class="includes_tax"
php wordpress woocommerce orders email-notifications
1个回答
0
投票

这只能是一个自定义的结果,你已经做了订单总数,或你的主题或插件的结果。默认情况下,Woocommerce没有这样的行为。在你的情况下,似乎是由于一个插件(或一些定制)。显示货币符号为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文件中。它应该可以解决你的问题。

但最好的方法应该是找出罪魁祸首,而不是在某个地方打补丁做错了一些定制。

© www.soinside.com 2019 - 2024. All rights reserved.