• Resolved Vishal Lohar

    (@vlohar08)


    Hi, I am using this plugin for tracking woocommerce orders.

    I need to use this _wc_shipment_tracking_items meta key but the output is something like this –

    a:1:{i:0;a:9:{s:17:"tracking_provider";s:10:"india-post";s:24:"custom_tracking_provider";s:0:"";s:20:"custom_tracking_link";s:0:"";s:15:"tracking_number";s:13:"CA136539150IN";s:21:"tracking_product_code";s:0:"";s:12:"date_shipped";s:10:"1677196800";s:13:"products_list";s:0:"";s:14:"status_shipped";s:1:"1";s:11:"tracking_id";s:32:"1c8d1432a24ca72ff9510c56deah717bf";}}

    How can i extract tracking number from this data? I am not an expert in PHP so i need your help!

    • This topic was modified 1 year, 9 months ago by Vishal Lohar.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author algol.plus

    (@algolplus)

    Thread Starter Vishal Lohar

    (@vlohar08)

    The custom code mentioned in the article is not working. The tracking number field is empty. I checked the debug file and didn’t find any helpful logs. The code was posted in 2019 and a lot might have changed in the tracking plugin since then.

    Thread Starter Vishal Lohar

    (@vlohar08)

    Please update the code on your blog post. This code is working for me.

    add_filter('woe_get_order_value_tracking_numbers', function ($value, $order,$field) {
        if( class_exists("WC_Advanced_Shipment_Tracking_Actions") ) {
            $st = WC_Advanced_Shipment_Tracking_Actions::get_instance();
            $tracking_items = $st->get_tracking_items( $order->get_id() );
            $numbers = array();
            foreach($tracking_items as $item)
                $numbers[] = $item['tracking_number'];
            $value = join(", ", array_filter($numbers)) ;
        }
        return $value;
    }, 10, 3);
    Plugin Author algol.plus

    (@algolplus)

    Thank you!

    I’ve updated code to use class name WC_Advanced_Shipment_Tracking_Actions

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Export order tracking id’ is closed to new replies.