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