woocommerce改变客户主题

时间:2014-08-07 01:33:55

标签: php email woocommerce

我想更改woocommerce_email_subject_customer_invoice,但是这个只是编辑了管理员新客户订单主题行。你能告诉我如何正确编辑它,以便能够更改客户端使用的电子邮件主题行。

       /*
        * Subject filters: 
        *   woocommerce_email_subject_new_order
        *   woocommerce_email_subject_customer_procesing_order
        *   woocommerce_email_subject_customer_completed_order
        *   woocommerce_email_subject_customer_invoice
        *   woocommerce_email_subject_customer_note
        *   woocommerce_email_subject_low_stock
        *   woocommerce_email_subject_no_stock
        *   woocommerce_email_subject_backorder
        *   woocommerce_email_subject_customer_new_account
        *   woocommerce_email_subject_customer_invoice_paid
         **/
        add_filter('woocommerce_email_subject_new_order', 'change_admin_email_subject', 1, 2);

        function change_admin_email_subject( $subject, $order ) {
       global $woocommerce;

       $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);

        $subject = sprintf( '[%s] New Customer Order (# %s) from Name %s %s', $blogname, 
        $order->id, $order->billing_first_name, $order->billing_last_name );

        return $subject;
        }

1 个答案:

答案 0 :(得分:1)

而不是使用woocommerce_email_subject_customer_invoice使用woocommerce_email_subject_customer_invoice_paid

plugins/woocommerce/includes/emails/class-wc-email-customer-invoice.php内,检查以下内容:

如果状态==处理或已完成,则将主题设置为invoice_paid,否则只需发票。

所以对于订单状态:

  • 已完成:: woocommerce_email_subject_customer_invoice_paid
  • 处理:: woocommerce_email_subject_customer_invoice_paid
  • 其他所有内容:: woocommerce_email_subject_customer_invoice