亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

當訂單狀態發生變化時向 WordPress 用戶發送電子郵件?

當訂單狀態發生變化時向 WordPress 用戶發送電子郵件?

PHP
侃侃爾雅 2023-09-22 16:19:58
我正在使用一個名為 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 );



查看完整回答
反對 回復 2023-09-22
  • 1 回答
  • 0 關注
  • 108 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號