Last active
April 21, 2020 01:20
-
-
Save ChaseWiseman/f092d0c8dbc08f5b138995b18e4156e7 to your computer and use it in GitHub Desktop.
Send SMS notifications to customers when a customer-facing note is added to an order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // only include this if needed | |
/** | |
* Sends an SMS to the customer whenever a new customer note is added to an order. | |
* | |
* Customer notes usually trigger an email if enabled. | |
*/ | |
add_action( 'woocommerce_new_customer_note', function( $args ) { | |
if ( ! class_exists( 'WC_Twilio_SMS_Notification' ) || empty( $args['order_id'] ) || empty( $args['customer_note'] ) ) { | |
return; | |
} | |
$notification = new \WC_Twilio_SMS_Notification( $args['order_id'] ); | |
$notification->send_manual_customer_notification( $args['customer_note'] ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment