0
我想在woocommerce发送订单后发送额外的电子邮件,我想我正在使用错误的操作/挂钩。我哪里错了?如何在提交订单后发送额外的电子邮件(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
));
}
威尔是发送一个额外的电子邮件,如果我用的钩子? –
即使对于邮件或数据库等,您也可以在该函数中编写任何内容。 – AZinkey