Skip to content

Instantly share code, notes, and snippets.

@sabbir1991
Last active February 27, 2017 07:03
Show Gist options
  • Save sabbir1991/de780ed26390c33a029f26a52dd56d93 to your computer and use it in GitHub Desktop.
Save sabbir1991/de780ed26390c33a029f26a52dd56d93 to your computer and use it in GitHub Desktop.
Add extra shortcodes in sms body
<?php
//Add new shortcodes
add_filter( 'sat_sms_get_order_shortcodes', function( $codes ) {
$codes[] = '[order_pdf_voucher]';
return $codes;
} );
// For displaying your shortcoders in backend settings
add_filter( 'sat_sms_shortcode_insert_description', function( $content ) {
return $content . ' For PDF voucher add [order_pdf_voucher]';
} );
// For modifying the sms body with including your shortcoders.
add_filter( 'sat_sms_pharse_body', function( $body, $data ) {
$vaoucher_code = get_post_meta( $data['order_id'], '_order_key', true );
return str_replace( '[order_pdf_voucher_code]', $vaoucher_code, $body );
},10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment