Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( isset( $this->options['wc_notify_customer_payment_successful_enable'] ) ) {
- add_action( 'woocommerce_order_status_processing', array( &$this, 'successful_payment_notification_client' ) );
- }
- /*
- * WooCommerce Successful payment notification client
- *
- * @param $checkout
- */
- public function successful_payment_notification_client ( $order_id ) {
- // Check the mobile field is empty
- if ( empty( $_REQUEST['mobile'] ) ) {
- return;
- }
- $args = array(
- 'post_id' => $order_id,
- 'orderby' => 'comment_ID',
- 'order' => 'DESC',
- 'approve' => 'approve',
- 'type' => 'order_note',
- 'number' => 1
- );
- remove_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10, 1 );
- $notes = get_comments( $args );
- add_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10, 1 );
- $order = new WC_Order( $order_id );
- $this->sms->to = array( $_REQUEST['mobile'] );
- $template_vars = array(
- '%order_id%' => $order_id,
- '%order_number%' => $order->get_order_number(),
- '%status%' => $order->get_status(),
- '%billing_first_name%' => $_REQUEST['billing_first_name'],
- '%billing_last_name%' => $_REQUEST['billing_last_name'],
- '%comment%' => $notes[0]->comment_content,
- );
- $message = str_replace( array_keys( $template_vars ), array_values( $template_vars ), $this->options['wc_notify_customer_payment_successful_message'] );
- $this->sms->msg = $message;
- $this->sms->SendSMS();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement