【发布时间】:2017-01-11 06:49:54
【问题描述】:
当我的订单状态从待处理更改为处理中时,不会触发任何电子邮件。我检查了插件代码
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() );
}
我在函数中放置了一个测试邮件来检查这个触发函数是否被调用。但无论哪种方式都行不通。但是其他电子邮件,例如忘记密码,没有库存电子邮件通知工作正常,只有订单状态更改邮件无法正常工作对不起我的英语不好。 提前感谢您的帮助。
【问题讨论】:
标签: php wordpress woocommerce