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 characters
    
  
  
    
  | /** | |
| * Replace text in the tracking events description | |
| */ | |
| add_filter( 'trackship_tracking_event_description', 'replace_text_tracking_event_description', 10, 1 ); | |
| function replace_text_tracking_event_description( $message ) { | |
| // Add the text in $search and $replace array | |
| $search = array( | |
| "Mariam", // you can add multiple rows | |
| ); | |
| $replace = 'Masdar City'; | 
  
    
      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 characters
    
  
  
    
  | <?php | |
| /** | |
| * Triggered when a shipment status changes in TrackShip. | |
| * This callback function handles the custom action `ts_status_change_trigger` and sends a POST request | |
| * to an Integrately webhook URL to synchronize shipment updates. | |
| * Use this hook to execute custom actions, such as sending data to third-party platforms or triggering webhooks. | |
| * | |
| * @param int $order_id The WooCommerce order ID. | |
| * @param string $old_status The previous shipment status. | 
  
    
      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 characters
    
  
  
    
  | // Do not send data to TrackShip for specific provider | |
| add_filter( 'exclude_to_send_data_for_provider', 'exclude_to_send_data_for_provider', 10, 2 ); | |
| function exclude_to_send_data_for_provider( $bool, $tracking_provider ) { | |
| // Add your provider slug to this array for do not send data for provider | |
| $array = array( | |
| 'usps', | |
| 'fedex' | |
| ); | |
| return in_array( $tracking_provider, $array ) ? false : true; | |
| } | 
  
    
      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 characters
    
  
  
    
  | // TrackShip endpoint for whitelist from jwt | |
| add_filter( 'jwt_auth_whitelist', function ( $endpoints ) { | |
| $your_endpoints = array( | |
| '/wp-json/wc/v1/disconnect_from_trackship/', | |
| '/wp-json/wc/v1/tracking-webhook/', | |
| '/wp-json/wc/v1/check_ts4wc_installed/', | |
| '/wp-json/wc/v1/ts-update-carrier/', | |
| ); | |
| return array_unique( array_merge( $endpoints, $your_endpoints ) ); | |
| } ); | 
  
    
      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 characters
    
  
  
    
  | add_filter( 'tracking_page_tab_label', 'rename_tracking_page_tab' ); | |
| function rename_tracking_page_tab( $labels_name ) { | |
| // if you don't want to change all tab's names then you have to add particular tab's label code | |
| $labels_name['tracking_progress_label'] = 'Tracker progress'; // Change the name of the Tracking progress tab label | |
| $labels_name['items_label'] = 'Products in this Shipment'; // Change the name of the Progress tab label | |
| $labels_name['notifications_label'] = 'Shipment status notifications'; // Change the name of the Notifications tab label | |
| return $labels_name; | |
| } | 
  
    
      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 characters
    
  
  
    
  | // remove order id and email id section from Tracking page form | |
| add_filter( 'remove_order_id_section', '__return_true' ); | 
  
    
      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 characters
    
  
  
    
  | /* | |
| * add order status to trigger delivered status | |
| */ | |
| add_filter( 'allowed_order_status_for_delivered', 'allow_status_for_delivery_automation' ); | |
| function allow_status_for_delivery_automation( $order_statuses ) { | |
| $order_statuses[] = 'in_transit'; | |
| $order_statuses[] = 'packed'; | |
| $order_statuses[] = 'delivering'; //You can add your custom order statuses like this for delivery automation. | |
| return $order_statuses; | |
| } | 
  
    
      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 characters
    
  
  
    
  | <?php | |
| add_action( 'ast_trigger_ts_status_change', 'ast_send_status_change_sms_twillio', 10, 3 ); | |
| function ast_send_status_change_sms_twillio($order_id, $old_status, $new_status){ | |
| $wc_ast_api_key = get_option('wc_ast_api_key'); | |
| $blog_title = get_bloginfo(); | |
| if ( !is_plugin_active( 'woo-advanced-shipment-tracking/woocommerce-advanced-shipment-tracking.php' ) ) { | |
| return; | |
| } | |
| if( !$wc_ast_api_key ){ | |
| return; | 
  
    
      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 characters
    
  
  
    
  | <?php | |
| // Filter for change description before tracking form | |
| // Default text - To track your order please enter your Order ID in the box below and press the "Track" button. This was given to you on your receipt and in the confirmation email you should have received. | |
| add_filter( 'ast_tracking_page_front_text', 'ast_tracking_page_front_text_fun' ); | |
| function ast_tracking_page_front_text_fun($string){ | |
| $string = 'Updated Text'; | |
| return $string; | |
| } | |
| // Filter for change text of order label in form | 
  
    
      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 characters
    
  
  
    
  | /** | |
| * Remove text from the tracking events description | |
| */ | |
| add_filter( 'trackship_tracking_event_description', 'remove_text_tracking_event_description', 10, 1 ); | |
| function remove_text_tracking_event_description( $message ) { | |
| // add word in below $remove array to remove from tracking event description | |
| $remove = array( | |
| "Mariam", // you can add multiple rows | |
| ); | |
| $message = str_replace( $remove, "", $message ); |