WooCommerce - send custom email on custom order status change

后端 未结 4 767
轻奢々
轻奢々 2020-11-30 05:00

I added a custom status wc-order-confirmed:

// Register new status
function register_order_confirmed_order_status() {
    register_post_status(          


        
4条回答
  •  不知归路
    2020-11-30 05:59

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

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

    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' );
    

提交回复
热议问题