1. Home
  2. Docs
  3. Shipment Tracker for Wooc...
  4. Developers
  5. Action Hook

Action Hook

Fires whenever shipment status is updated for any order.

Parameters:
$order_id
(number) The ID of the order whose shipment tracking details have been updated.

$shipment_obj
(Bt_Sync_Shipment_Tracking_Shipment_Model) Object containing shipment tracking information of the order.

$shipment_obj_old
(Bt_Sync_Shipment_Tracking_Shipment_Model) Object containing previous shipment tracking information of the order.

Example:

<?php

       function bt_shipment_status_changed_callback( $order_id,$shipment_obj,$shipment_obj_old)
       {
               //latest shipment tracking:
              $courier_name = $shipment_obj->courier_name;
              $current_status = $shipment_obj->current_status;
              $awb = $shipment_obj->awb;
              $tracking_url = $shipment_obj->tracking_url;
              //previous shipment tracking:
              $old_courier_name = $shipment_obj_old->courier_name;
              $old_current_status = $shipment_obj_old->current_status;
              $old_awb = $shipment_obj_old->awb;
             $old_tracking_url = $shipment_obj_old->tracking_url;
             // do stuff
        }
       add_action( ‘bt_shipment_status_changed’, ‘bt_shipment_status_changed_callback’, 10, 3 );

How can we help?