In Woocommerce, to send sms payment information to the customer, I need to activate a trigger after a successful payment.
But I didn't find any hook do it
This is my plugin code:
if ( isset( $this->options['wc_notify_customer_payment_successful_enable'] ) ) {
add_action( '####Action to be used here#######', array( &$this, 'successful_payment_notification_client' ) );
}
/* WooCommerce Successful payment notification client
*
* @param $order_id
*/
public function successful_payment_notification_client ( $order_id ) {
// Check the mobile field is empty
if ( empty( $_REQUEST['mobile'] ) ) {
return;
}
$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'],
'%transaction_id%' => get_post_meta( $order_id,'_payment_method_title', true ),
);
$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();
}
The desired hook should come in line two of my code.
Any help will be appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…