簡體   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