当我的订单从待处理状态更改为处理状态时,不会触发任何电子邮件。我检查了插件代码
public function __construct() {
$this->id = 'customer_processing_order';
$this->title = __( 'Processing order', 'woocommerce' );
$this->description = __( 'This is an order notification sent to the customer after payment containing order details.', 'woocommerce' );
$this->heading = __( 'Thank you for your order', 'woocommerce' );
$this->subject = __( 'Your {blogname} order receipt from {order_date}', 'woocommerce' );
$this->template_html = 'emails/customer-processing-order.php';
$this->template_plain = 'emails/plain/customer-processing-order.php';
// Triggers for this email
add_action( 'woocommerce_order_status_pending_to_processing_notification', array( $this, 'trigger' ) );
// Call parent constructor
parent::__construct();
}
public function trigger( $order_id ) {
if ( $order_id ) {
$this->object = wc_get_order( $order_id );
$this->recipient = $this->object->billing_email;
$this->find['order-date'] = '{order_date}';
$this->find['order-number'] = '{order_number}';
$this->replace['order-date'] = date_i18n( wc_date_format(), strtotime( $this->object->order_date ) );
$this->replace['order-number'] = $this->object->get_order_number();
}
if ( ! $this->is_enabled() || ! $this->get_recipient() ) {
return;
}
wp_mail( $this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );
}
我在测试邮件功能中检查了这个触发函数是否被调用。但要么它不起作用。但其他电子邮件,如忘记密码,没有股票电子邮件通知工作正常只有订单状态更改邮件不工作抱歉我的英语不好。 在此先感谢您的帮助。