我正在使用一個名為 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 = '[email protected]';
$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 關注
- 108 瀏覽
添加回答
舉報
0/150
提交
取消