且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

WooCommerce - 发送自定义订单状态更改的自定义电子邮件

更新时间:2022-12-10 20:01:45

正如 Xcid 的回答所示,您需要注册电子邮件.

As Xcid's answer indicates, you need to register the email.

在 WC 2.2+ 中,我相信您可以通过以下方式做到这一点:

In WC 2.2+ I believe you can do this via the following:

add_action( 'woocommerce_order_status_wc-order-confirmed', array( WC(), 'send_transactional_email' ), 10, 10 );

我在 WooCommerce 2.3 中添加了一个过滤器,所以当它出现时,自定义电子邮件将能够添加到 WooCommerce 注册的电子邮件操作列表中:

I'd added a filter to WooCommerce 2.3, so when that comes out custom emails will be able to be added to the list of email actions that WooCommerce registers:

// As of WooCommerce 2.3
function so_27112461_woocommerce_email_actions( $actions ){
    $actions[] = 'woocommerce_order_status_wc-order-confirmed';
    return $actions;
}
add_filter( 'woocommerce_email_actions', 'so_27112461_woocommerce_email_actions' );