Skip to content

Instantly share code, notes, and snippets.

@web-hat
Last active November 19, 2017 14:35
Show Gist options
  • Save web-hat/7346762f3edb39d194c904685406e1d8 to your computer and use it in GitHub Desktop.
Save web-hat/7346762f3edb39d194c904685406e1d8 to your computer and use it in GitHub Desktop.
For Shipment Tracking version 1.4.0 or above
<?php
$order_id = method_exists($order, 'get_id') ? $order->get_id() : $order->id;
//getting shipping details
$objWC_Shipment = WC_Shipment_Tracking_Actions::get_instance();
$shipping_details = $objWC_Shipment->get_tracking_items($order_id);
if (!empty($shipping_details)) {
foreach ($shipping_details as $shipping_detail) {
$order_data['shipping_details'][] = array(
'tracking_provider' => $shipping_detail['tracking_provider'],
'tracking_number' => $shipping_detail['tracking_number'],
'date_shipped' => $shipping_detail['date_shipped']
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment