Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ChaseWiseman/f092d0c8dbc08f5b138995b18e4156e7 to your computer and use it in GitHub Desktop.
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
<?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