Php 更改“;航运;Woocommerce电子邮件表中的标签总数?

Php 更改“;航运;Woocommerce电子邮件表中的标签总数?,php,wordpress,woocommerce,orders,email-notifications,Php,Wordpress,Woocommerce,Orders,Email Notifications,我正在WooCommerce中自定义订单电子邮件模板,需要将“发货”标题更改为“交货”,并将“发货地址”更改为“交货地址”。我尝试了一个插件,“说什么”,这将改变文本,但它没有工作。有一个循环处理所有这些信息 这是“email order details.php”页面第52行的代码 可以使用以下挂钩函数完成此操作: add_filter( 'woocommerce_get_order_item_totals', 'renaming_shipping_order_item_totals', 10

我正在WooCommerce中自定义订单电子邮件模板,需要将“发货”标题更改为“交货”,并将“发货地址”更改为“交货地址”。我尝试了一个插件,“说什么”,这将改变文本,但它没有工作。有一个循环处理所有这些信息

这是“email order details.php”页面第52行的代码


可以使用以下挂钩函数完成此操作:

add_filter( 'woocommerce_get_order_item_totals', 'renaming_shipping_order_item_totals', 10, 3 );
function renaming_shipping_order_item_totals( $total_rows, $order, $tax_display ){
    // Only on emails notifications
    if( ! is_wc_endpoint_url() )
        $total_rows['shipping']['label'] = __('Delivery', 'woocommerce');

    return $total_rows;
}
代码进入活动子主题(或活动主题)的function.php文件。测试和工作


要将“配送地址”标签更改为“配送地址”,您需要复制/编辑模板
email address.php
,替换为:

_e( 'Shipping address', 'woocommerce' );
作者:


请参阅:

谢谢!!成功了。如何将“送货地址”标签更改为“送货地址”。还有一个简单的问题,可能是愚蠢的,你是如何计算出数组中字段的名称的。woocommerce/templates/emails/email-addresses.php中第42行提到了该字段。不过,更改它给了我一个致命的错误。
add_filter( 'woocommerce_get_order_item_totals', 'renaming_shipping_order_item_totals', 10, 3 );
function renaming_shipping_order_item_totals( $total_rows, $order, $tax_display ){
    // Only on emails notifications
    if( ! is_wc_endpoint_url() )
        $total_rows['shipping']['label'] = __('Delivery', 'woocommerce');

    return $total_rows;
}
_e( 'Shipping address', 'woocommerce' );
_e( 'Delivery address', 'woocommerce' );