Skip to content

Instantly share code, notes, and snippets.

@manutheblacker
Last active September 28, 2022 11:03
Show Gist options
  • Save manutheblacker/e848b23950b2211a50a4ee8ee1f0391b to your computer and use it in GitHub Desktop.
Save manutheblacker/e848b23950b2211a50a4ee8ee1f0391b to your computer and use it in GitHub Desktop.
How to add custom sms gateway to Ultimate SMS Notifications for WooCommerce ?
<?php
// Use this filter to hide the default API settings.
add_filter('woo_usn_display_sms_api', '__return__false');
// Add your fields for filling SMS Gateways API Keys.
add_action('woo_usn_options_before_sms_api_fields', your_function_here(){
// display your fields here and make sure to add button to save the settings
});
// Save your SMS credentials .
add_action('woo_usn_save_sms_gateway_credentials', your_function_here( $api_choosed, $data ) {
// save into the database your api keys for future use when sending sms notifications.
}, 99, 2);
add_filter('woo_usn_send_sms_to_customer', your_function_here( $status_code, $apiused, $phone_number, $message_to_send ) {
// this hook allows you to send sms using custom sms gateway.
// @status_code : the status code by default is 400
// @apiused : the hook will provide the sms gateways used for sending the sms.
// @phone_number : the customer phone that will receive the sms, by default, the plugin already sanitize the phone number,
// @message_to_send : the message you are going to send to your customer
return $status_code; // you must return a code, 200 if the sms is sent or 400 if there is an error.
}, 99, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment