>我在这个相关答案中找到了我问题的部分可行的答案:
发送电子邮件通知何时下单状态-昌河-弗隆-彭迪格-取消
我正在考虑使用提供的解决方案,但想看看是否可以更改电子邮件通知以明确显示"待处理付款订单现已取消",以便与常规取消的订单不同。
我该怎么做?
您可以尝试这样做,这将自定义此电子邮件的标题和主题:
add_action('woocommerce_order_status_pending_to_cancelled', 'cancelled_send_an_email_notification', 10, 2 );
function cancelled_send_an_email_notification( $order_id, $order ){
// Getting all WC_emails objects
$email_notifications = WC()->mailer()->get_emails();
// Cancelled Order email notification
$email_obj = $email_notifications['WC_Email_Cancelled_Order'];
// Customizing heading and subject
$email_obj->settings['heading'] = __( "Pending payment order now Cancelled", "woocommerce" );
$email_obj->settings['subject'] = __( "[{site_title}] Pending payment order ({order_number}), now Cancelled", "woocommerce" );
// Sending the email
$email_obj->trigger( $order_id );
}
代码进入函数.php活动子主题(或主题(的文件或任何插件文件中。
经过测试和工作