【问题标题】:Remove "Shipping" label from Woocommerce Email notifications从 Woocommerce 电子邮件通知中删除“运输”标签
【发布时间】:2019-04-18 06:24:29
【问题描述】:

我想从 woocommerce 订单确认电子邮件表中删除或隐藏“运输”标签。

【问题讨论】:

  • 到目前为止你自己尝试过什么?你能展示你尝试过的代码吗?

标签: php wordpress woocommerce shipping email-notifications


【解决方案1】:

以下小代码 sn-p 将仅从电子邮件通知中删除标签“Shipping”:

add_filter( 'woocommerce_get_order_item_totals', 'customize_email_order_line_totals', 1000, 3 );
function customize_email_order_line_totals( $total_rows, $order, $tax_display ){
    // Only on emails notifications
    if( ! is_wc_endpoint_url() || ! is_admin() ) {
        // Remove "Shipping" label text from totals rows
        $total_rows['shipping']['label'] = '';
    }
    return $total_rows;
}

代码进入您的活动子主题(活动主题)的 function.php 文件中。经过测试并且可以工作。


要从电子邮件通知中删除总运费行,请改用以下内容:

add_filter( 'woocommerce_get_order_item_totals', 'customize_email_order_line_totals', 1000, 3 );
function customize_email_order_line_totals( $total_rows, $order, $tax_display ){
    // Only on emails notifications
    if( ! is_wc_endpoint_url() || ! is_admin() ) {
        // Remove shipping line from totals rows
        unset($total_rows['shipping']);
    }
    return $total_rows;
}

代码进入您的活动子主题(活动主题)的 function.php 文件中。经过测试并且可以工作。


无法定位特定的电子邮件通知。

【讨论】:

    猜你喜欢
    • 2018-05-15
    • 1970-01-01
    • 2019-03-17
    • 1970-01-01
    • 2018-01-12
    • 2017-12-15
    • 1970-01-01
    • 2017-09-16
    • 1970-01-01
    相关资源
    最近更新 更多