📅  最后修改于: 2022-03-11 14:53:58.526000             🧑  作者: Mango
Kishore Sms Settings
User name
User Mobile number
User Shipping Address
User Billing Address
User Order date
User Email
[user_name]
[user_number]
[user_shipping]
[user_billing]
[user_order_date]
[user_email]
Enter Order Id :
Enter Message :
id,$order->order_total.' Rs',$order->billing_last_name,$order->billing_phone.','.$admin_number,$order->completed_date,$order->billing_email);
$id = urlencode(str_replace($to_find, $to_replace_with, $to_send));
$to_user_url = "http://enterprise.smsgupshup.com/GatewayAPI/rest?method=SendMessage&send_to=".$order->billing_phone."&msg=".$id."&msg_type=TEXT&userid=2012345&auth_scheme=plain&password=testing&v=1.1&format=text";
file_get_contents($to_user_url);
}
add_action( 'woocommerce_thankyou','send_confirmation_message', $priority = 10, $accepted_args = 1 );
// Sending message on order status completed
function sa_order_status_completed($order_id){
// send order completed message to user
$order = new WC_Order( $order_id );
// get options
$sms_options = get_option( 'my_option_name');
$to_send = $sms_options['sa_on_order_completed'];
$to_find = array('[user_order_id]','[user_order_amount]','[user_name]','[user_number]','[user_order_date]','[user_email]');
$to_replace_with = array($order->id,$order->order_total.' Rs',$order->billing_last_name,$order->billing_phone,$order->completed_date,$order->billing_email);
$id = urlencode(str_replace($to_find, $to_replace_with, $to_send));
$to_user_url = "http://enterprise.smsgupshup.com/GatewayAPI/rest?method=SendMessage&send_to=".$order->billing_phone."&msg=".$id."&msg_type=TEXT&userid=200123456&auth_scheme=plain&password=testing&v=1.1&format=text";
file_get_contents($to_user_url);
}
add_action( 'woocommerce_order_status_completed', 'sa_order_status_completed' );
?>