Woocommerce - 发送客户消息"新订单"电子邮件

时间:2017-05-09 12:08:50

标签: wordpress woocommerce

我们使用Woocommerce来销售汽车零件。 通常,客户在订单处理期间将(重要)消息写入文本字段。 我们得到了"新订单"来自系统的电子邮件,但邮件没有包含在内。 我们如何更改电子邮件模板以接收来自客户的消息?

感谢您的帮助

2 个答案:

答案 0 :(得分:2)

您可以在Wp-Admin部分的WooCommerce设置区域中配置确认电子邮件的一些详细信息:WooCommerce - >设置 - >电子邮件。

您也可以在此处编辑模板文件:

wp-content/plugins/woocommerce/templates/emails

重要:不要编辑插件目录中的文件,因为第一次插件更新后您的更改将会丢失。可以通过将其复制到

来覆盖此模板

yourtheme/woocommerce/emails/template_name.php

因此,您可以编辑模板文件并将文本字段数据附加到电子邮件中。

答案 1 :(得分:0)

For the future if someone else is looking for an answer. If you're looking to add the customer note to the new order email, you can just use one of the action hooks instead of overriding the email template:

// Hook this function into woocommerce_email_order_meta 
add_action( 'woocommerce_email_order_meta', 'woo_add_customer_note_to_email', 10, 3 );

function woo_add_customer_note_to_email( $order, $is_admin, $plain_text = false ) {
    // Retrieve the customer note as a variable from the $order array.
    $customer_note = $order->get_customer_note();

    // You want to send those only to the Admin, or only customers, modify here. Right now it's only sending to admin emails.
    if ( !$is_admin || $is_admin && empty($customer_note) ) {
       return;
    }
    // Setup our html markup for inclusion in the email. Note, you should inline your styles, which is best practice for HTML emails.
    echo '<div style="font-family: &quot;Helvetica Neue&quot;, Helvetica, Roboto, Arial, sans-serif; margin-top: 40px;"><h2 style=""color: #6a6057; display: block; font-family: &quot;Helvetica Neue&quot;, Helvetica, Roboto, Arial, sans-serif; font-size: 18px; font-weight: bold; line-height: 130%; margin: 0 0 18px; text-align: left;">Customer Notes</h2>';

    echo '<blockquote><span style="color: #505050; font-family: &quot;Helvetica Neue&quot;, Helvetica, Roboto, Arial, sans-serif;">' . wpautop( wptexturize( $customer_note ) ) . '</span></blockquote>';

    echo '</div>';
}