Woocommerce电子邮件通知

时间:2017-01-11 06:49:54

标签: php wordpress woocommerce

当我的订单从待处理状态更改为处理状态时,不会触发任何电子邮件。我检查了插件代码

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() );
}

我在测试邮件功能中检查了这个触发函数是否被调用。但要么它不起作用。但其他电子邮件,如忘记密码,没有股票电子邮件通知工作正常只有订单状态更改邮件不工作抱歉我的英语不好。 在此先感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

如果您手动更改状态,我不确定是否应发送电子邮件。但你可以宁愿使用" Order Actions"在右侧选择发送该电子邮件。 这也是一个很好的测试,选择" New Order"发送正确的电子邮件。并等待它。

enter image description here

如果这没有帮助,请在WooCommerce下重新检查您的电子邮件设置,并确保在"新订单"下设置了正确的电子邮件。