Export order tracking id | WordPress.org

[ad_1]

Hi

please, read this article

https://algolplus.freshdesk.com/support/solutions/articles/25000022099-woocommerce-shipment-tracking-by-woocommerce

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.

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);

Thank you!

I’ve updated code to use class name WC_Advanced_Shipment_Tracking_Actions

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer