[英]How to send extra email after order submitted (Woocommerce)?
I am trying to send an extra email after an order is sent on woocommerce and I think I am using the wrong action/hook. 在woocommerce发送订单后,我试图发送一封额外的电子邮件,我认为我使用了错误的操作/钩子。 Where am I going wrong?
我要去哪里错了?
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
) );
}
I think you are looking for woocommerce_email_order_details
我认为您正在寻找
woocommerce_email_order_details
https://docs.woocommerce.com/wc-apidocs/hook-docs.html https://docs.woocommerce.com/wc-apidocs/hook-docs.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.