dongxiaoguang9108 2018-10-24 08:12
浏览 76
已采纳

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

My woocommerce sends out an as it is suppose to.

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.

this is how my tax field looks in the email.

 Total:     DKK 0.00 <small class="includes_tax"
  • 写回答

1条回答 默认 最新

  • dsvbtgo639708 2018-10-24 08:38
    关注

    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.

    Now order totals rows in Woocommerce email notifications are generated using the WC_Order method 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). 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型