To customize the SMS message notification is possible using available filter “wpcsms_message” hook of the plugin.
Note: This “wpcsms_message” is only available with the SMS Add on 4.3.4+ version
The following sample code on how to customize SMS message.
function my_custom_sms_message( $message, $post_id, $find, $replace ){
// Note: In this sample code will change the SMS massage when the shipment status is "Enroute"
$status = get_post_meta( $post_id, 'wpcargo_status', true );
if( $status === 'Enroute' ){
// Note: Make sure that the metakey code exist in the system
// In this sample code we used the sample metakey code
// @ {wpcargo_tracking_number} - Shipment Number
// @ {status} - Shipment Status
// @ {wpcargo_shipper_name} - Shipper Name
// @ {wpcargo_receiver_name} - Receiver Name
$custom_message = "{wpcargo_tracking_number} - Status {status} from {wpcargo_shipper_name} to {wpcargo_receiver_name}";
// Convert metakey code into actual shipment data
$message = str_replace($find, $replace, $custom_message);
}
return $message;
}
add_filter('wpcsms_message', 'my_custom_sms_message', 10, 4 );
