Last active
April 19, 2022 12:45
Revisions
-
zorem revised this gist
Apr 19, 2022 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ function ast_pro_wc_twilio_sms_message_replacement( $message, $order ) { if ( 'completed' == $order_status || 'shipped' == $order_status ) { if ( count( $tracking_items ) > 0 ) { foreach ( $tracking_items as $key => $tracking_item ) { $message .= sprintf( __( "Your order was shipped with %s and your tracking code is: %s", 'ast-pro' ), $tracking_item['formatted_tracking_provider'], $tracking_item['tracking_number'] ); } } } @@ -29,11 +29,11 @@ function ast_pro_wc_twilio_sms_message_replacement( $message, $order ) { if ( 'partial-shipped' == $order_status ) { if ( count( $tracking_items ) > 0 ) { foreach ( $tracking_items as $key => $tracking_item ) { $message .= sprintf( __( "Your order was Partially Shipped with %s and your tracking code is: %s", 'ast-pro' ), $tracking_item['formatted_tracking_provider'], $tracking_item['tracking_number'] ); } } } return $message; } } -
zorem revised this gist
Apr 19, 2022 . 1 changed file with 7 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,15 +9,18 @@ function ast_pro_wc_twilio_sms_message_replacement( $message, $order ) { } $order_id = $order->get_id(); $order_status = $order->get_status(); $tracking_items = ast_get_tracking_items($order_id); //echo '<pre>';print_r($tracking_items);echo '</pre>'; //You can comment this condition if you don't want to add tracking information on completed order status SMS message. if ( 'completed' == $order_status || 'shipped' == $order_status ) { if ( count( $tracking_items ) > 0 ) { foreach ( $tracking_items as $key => $tracking_item ) { $message .= sprintf( wp_kses( __( "Your order was shipped with %s and your tracking code is: <a href='%s'>%s</a>", 'ast-pro' ), array( 'a' => array( 'href' => array() ) ) ), $tracking_item['formatted_tracking_provider'], $tracking_item['ast_tracking_link'], $tracking_item['tracking_number'] ); } } } @@ -26,11 +29,11 @@ function ast_pro_wc_twilio_sms_message_replacement( $message, $order ) { if ( 'partial-shipped' == $order_status ) { if ( count( $tracking_items ) > 0 ) { foreach ( $tracking_items as $key => $tracking_item ) { $message .= sprintf( wp_kses( __( "Your order was Partially Shipped with %s and your tracking code is: <a href='%s'>%s</a>", 'ast-pro' ), array( 'a' => array( 'href' => array() ) ) ), $tracking_item['formatted_tracking_provider'], $tracking_item['ast_tracking_link'], $tracking_item['tracking_number'] ); } } } //echo $message;exit; return $message; } } -
zorem revised this gist
Apr 19, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ function ast_pro_wc_twilio_sms_message_replacement( $message, $order ) { return; } $order_id = $order->get_id(); $order_status = $order->get_status(); $tracking_items = ast_get_tracking_items($order_id); -
zorem revised this gist
Apr 13, 2022 . 1 changed file with 4 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,22 +4,20 @@ if ( !function_exists( 'ast_pro_wc_twilio_sms_message_replacement' ) ) { function ast_pro_wc_twilio_sms_message_replacement( $message, $order ) { if ( !function_exists( 'ast_get_tracking_items' ) ) { return; } $order_id = $order->get_order_number(); $order_status = $order->get_status(); $tracking_items = ast_get_tracking_items($order_id); //You can comment this condition if you don't want to add tracking information on completed order status SMS message. if ( 'completed' == $order_status || 'shipped' == $order_status ) { if ( count( $tracking_items ) > 0 ) { foreach ( $tracking_items as $key => $tracking_item ) { $message .= sprintf( __( "Your order was shipped with %s and your tracking code is: %s", 'ast-pro' ), $tracking_item['formatted_tracking_provider'], $tracking_item['tracking_number'] ); } } } @@ -28,7 +26,7 @@ function ast_pro_wc_twilio_sms_message_replacement( $message, $order ) { if ( 'partial-shipped' == $order_status ) { if ( count( $tracking_items ) > 0 ) { foreach ( $tracking_items as $key => $tracking_item ) { $message .= sprintf( __( "Your order was Partially Shipped with %s and your tracking code is: %s", 'ast-pro' ), $tracking_item['formatted_tracking_provider'], $tracking_item['tracking_number'] ); } } } -
zorem created this gist
Apr 2, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ /* add AST tracking info in customer SMS using Twilio SMS Notifications plugin */ add_filter( 'wc_twilio_sms_customer_sms_before_variable_replace', 'ast_pro_wc_twilio_sms_message_replacement', 10, 2 ); if ( !function_exists( 'ast_pro_wc_twilio_sms_message_replacement' ) ) { function ast_pro_wc_twilio_sms_message_replacement( $message, $order ) { if ( !class_exists( 'WC_Advanced_Shipment_Tracking_Actions' ) ) { return; } $order_id = $order->get_order_number(); $order_status = $order->get_status(); if ( function_exists( 'ast_get_tracking_items' ) ) { $tracking_items = ast_get_tracking_items($order_id); } //You can comment this condition if you don't want to add tracking information on completed order status SMS message. if ( 'completed' == $order_status || 'shipped' == $order_status ) { if ( count( $tracking_items ) > 0 ) { foreach ( $tracking_items as $key => $tracking_item ) { $message .= sprintf( __( "Your order was shipped with %s and your tracking code is: %s", 'woo-advanced-shipment-tracking' ), $tracking_item['formatted_tracking_provider'], $tracking_item['tracking_number'] ); } } } //You can comment this condition if you don't want to add tracking information on Partially Shipped order status SMS message. if ( 'partial-shipped' == $order_status ) { if ( count( $tracking_items ) > 0 ) { foreach ( $tracking_items as $key => $tracking_item ) { $message .= sprintf( __( "Your order was Partially Shipped with %s and your tracking code is: %s", 'woo-advanced-shipment-tracking' ), $tracking_item['formatted_tracking_provider'], $tracking_item['tracking_number'] ); } } } return $message; } }