繁体   English   中英

如何更改电子邮件中的woocommerce客户详细信息标签?

[英]How to change woocommerce customer details labels in email?

我已更改了客户备忘的客户详细信息标签,但未更改“新订单”电子邮件中的标签。 我该如何更改?

提交订单后,这是我如何更改它在发票页面上的显示方式:

<header><h2><?php _e( 'Customer Details', 'woocommerce' ); ?></h2></header>

<table class="shop_table customer_details">
<?php if ( $order->customer_note ) : ?>
    <tr>
        <th><?php _e( 'Requested Dates:', 'woocommerce' ); ?></th>
        <td><?php echo wptexturize( $order->customer_note ); ?></td>
    </tr>
<?php endif; ?>

这对电子邮件没有任何作用。 这是它在电子邮件中的显示方式的屏幕截图:

我想让它说“ Requested Dates”而不是“ Note”

我在email-customer-details.php文件中找到了以下代码:

<h2><?php _e( 'Customer details', 'woocommerce' ); ?></h2>
<ul>
<?php foreach ( $fields as $field ) : ?>
    <li><strong><?php echo wp_kses_post( $field['label'] ); ?>: </strong> 
<span class="text"><?php echo wp_kses_post( $field['value'] );    ?></span></li>
<?php endforeach; ?>
</ul>

解决该问题可能会有所帮助。

您可以过滤woocommerce_email_customer_details_fields ,这是传递到email-customer-details.php模板的信息数组。

function so_41986388_email_customer_details_fields( $fields, $sent_to_admin, $order ){
    if( isset( $fields['customer_note'] ) ) {
        $fields['customer_note']['label'] = __( 'Requested Dates:', 'your-text-domain' );
    }
    return $fields;
}
add_filter( 'woocommerce_email_customer_details_fields', 'so_41986388_email_customer_details_fields', 10, 3 );

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM