我正在使用一个名为 RestroPress 的插件 - 它用于餐厅送货。我想创建一个脚本,以便在$order_statuses设置为'ready'电子邮件时发送到特定的 WordPress 用户角色。这是一个示例代码,其中包含我获取此信息的位置:function rpress_get_order_statuses() { $order_statuses = array( 'pending' => __( 'Pending', 'restropress' ), 'accepted' => __( 'Accepted', 'restropress' ), 'processing' => __( 'Processing', 'restropress' ), 'ready' => __( 'Ready', 'restropress' ), 'transit' => __( 'In Transit', 'restropress' ), 'cancelled' => __( 'Cancelled', 'restropress' ), 'completed' => __( 'Completed', 'restropress' ), ); return apply_filters( 'rpress_order_statuses', $order_statuses );}关于我如何做到这一点的任何线索?
1 回答
阿波罗的战车
TA贡献1862条经验 获得超6个赞
function send_customer_purchase_notification_ready( $payment_id, $new_status ) {
$order_status = rpress_get_option( $new_status );
if ( !empty( $payment_id ) && $new_status !== 'pending' && $new_status == 'ready' ) {
$message = 'Order is ready';
$to = 'harshitvaishnav612@gmail.com';
$subject = "Order is ready";
$headers = '';
//Here put your Validation and send mail
$sent = wp_mail($to, $subject, strip_tags($message), $headers);
}
}
add_action( 'rpress_update_order_status', 'send_customer_purchase_notification_ready' , 10, 2 );
- 1 回答
- 0 关注
- 77 浏览
添加回答
举报
0/150
提交
取消