java怎么修改订单状态_在WooCommerce中自定义订单状态更改时发送电子邮件通知

我在我的WooCommerce中创建了一个名为Back Order( wc-backorder )的自定义订单状态:

/**

* Add custom status to order list

*/

add_action( 'init', 'register_custom_post_status', 10 );

function register_custom_post_status() {

register_post_status( 'wc-backorder', array(

'label' => _x( 'Back Order', 'Order status', 'woocommerce' ),

'public' => true,

'exclude_from_search' => false,

'show_in_admin_all_list' => true,

'show_in_admin_status_list' => true,

'label_count' => _n_noop( 'Back Order (%s)', 'Back Order (%s)', 'woocommerce' )

) );

}

/**

* Add custom status to order page drop down

*/

add_filter( 'wc_order_statuses', 'custom_wc_order_statuses' );

function custom_wc_order_statuses( $order_statuses ) {

$order_statuses['wc-backorder'] = _x( 'Back Order', 'Order status', 'woocommerce' );

return $order_statuses;

}

现在,我希望在收到已获得状态报价的订单时收到电子邮件 . 我根据这篇有用的文章创建了一个插件:How to Add a Custom WooCommerce Email

This link包含我的插件源代码和functions.php代码 .

我在 function.php 中添加了钩子:

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

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

订单变为“延期交货”状态时,没有任何反应 .

有任何想法吗?

我已经尝试了很多不同的钩子,但我似乎无法运行触发器功能 .

我使用的是最新版本的WordPress和WooCommerce(3.0)

谢谢

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值