INDEX
- To Send SMS
- To Modify Parameters before sending any SMS
- To get SMS Alert Service Response after Send SMS
- Woocommerce before Send SMS to Customer
- Woocommerce before Send SMS to Admin
- OTP Verification for Custom Forms
Hooks and Actions
This section is specifically for developers who wish to extend the functionality of this plugin as per their needs.
To Send SMS
do_action('sa_send_sms', '918010551055', 'Here is the sms.');
To Modify Parameters before sending any SMS
function modify_sms_text($params){
//do your stuff here
return $params;
}
add_filter('sa_before_send_sms', 'modify_sms_text');
To get SMS Alert Service Response after Send SMS
function get_smsalert_response($params)
{
//do your stuff here
return $params;
}
add_filter('sa_after_send_sms', 'get_smsalert_response');
Woocommerce before Send SMS to Customer
function modify_sms($params, $wc_order_id)
{
//do your stuff here
return $params;
}
add_filter('sa_wc_order_sms_customer_before_send', 'modify_sms', 1, 2);
Woocommerce before Send SMS to Admin
function modify_sms($params, $wc_order_id)
{
//do your stuff here
return $params;
}
add_filter('sa_wc_order_sms_admin_before_send', 'modify_sms', 1, 2);
OTP Verification
you can enable OTP verification in any form using the below shortcode. You just need change Phone number field jquery selector field and submit button selector. In the example below just change .sa-phone-field
and .user-form-btn
as per fields in your form. phone_selector refers to the selector of your Phone field in the form, submit_selector refers to the selector of your form submit button.
[sa_verify phone_selector=".sa-phone-field" submit_selector=".user-form-btn"]
FAQ’s
How can i send SMS to Shipping Phone instead of Billing Phone?
By default woocommerce does not have any shipping phone field, but in case if you have added a custom phone field in your woocommerce powered website, you can place this code in your functions.php file which is located in your theme folder.
function modify_sms($params, $wc_order_id) { if( !$wc_order_id ) { return $params; } //please ensure to replace '_shipping_phone' with appropriate variable $params['number'] = get_post_meta( $wc_order_id, '_shipping_phone', true ); return $params; } add_filter('sa_wc_order_sms_customer_before_send', 'modify_sms', 1, 2);