【问题标题】:Woocommerce email notificationWoocommerce 电子邮件通知
【发布时间】: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


    【解决方案1】:

    如果您手动更改状态,我不确定是否应该发送电子邮件。但是您可以使用右侧的“订单操作”来选择发送该电子邮件。 这也是一个很好的测试,选择“新订单”发送正确的电子邮件。并等待它。

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

    【讨论】:

    猜你喜欢
    • 2018-03-10
    • 1970-01-01
    • 1970-01-01
    • 2018-01-07
    • 2019-01-12
    • 2017-06-15
    • 1970-01-01
    • 2021-05-02
    • 2021-11-06
    相关资源
    最近更新 更多