【问题标题】:How to send extra email after order submitted (Woocommerce)?提交订单后如何发送额外的电子邮件(Woocommerce)?
【发布时间】:2017-10-10 04:55:30
【问题描述】:

在 woocommerce 上发送订单后,我尝试发送额外的电子邮件,但我认为我使用了错误的操作/挂钩。我哪里错了?

function email_processing_notification( $order_id ) {

    $order = wc_get_order( $order_id );

    // load the mailer class
    $mailer = WC()->mailer();

    $recipient = '***@gmail.com';
    $subject = __('Some Subject', 'test');
    $content = get_processing_notification_content( $order, $subject, $mailer );
    $headers = "Content-Type: text/html\r\n";

    $mailer->send( $recipient, $subject, $content, $headers );

}

add_action( 'woocommerce_order_status_pending_to_processing_notification', 'email_processing_notification', 10, 1 );


function get_processing_notification_content( $order, $heading = false, $mailer ) {

    $template = 'emails/customer-processing-order.php';

    return wc_get_template_html( $template, array(
        'order'         => $order,
        'email_heading' => $heading,
        'sent_to_admin' => true,
        'plain_text'    => false,
        'email'         => $mailer
    ) );
}

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

    我想你在找woocommerce_email_order_details

    https://docs.woocommerce.com/wc-apidocs/hook-docs.html

    【讨论】:

    • 如果我使用那个钩子会发送额外的电子邮件吗?
    猜你喜欢
    • 1970-01-01
    • 2018-10-24
    • 2015-03-28
    • 2016-07-26
    • 1970-01-01
    • 1970-01-01
    • 2016-02-23
    • 1970-01-01
    相关资源
    最近更新 更多