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.

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

报告相同问题?