Advanced Shipment Tracking for WooCommerce
Need to export tracking numbers from Advanced Shipment Tracking (AST)? Here’s exactly how.
Step 1: Add the meta keys
Open your export profile in Advanced Order Export for WooCommerce.
Go to Setup Fields. Click Add Field three times. Create these three custom fields:
tracking_providertracking_numbershipping_date
Critical: Use GREEN meta keys. Green means new custom fields. Gray means existing fields. Click the text box under the dropdowns. Type the key. Press Confirm.
Move all three to your left column (exported fields list).
Or you can look at the article.
Step 2: Add the code
Go to Misc Settings. Check Custom PHP code to modify output. Paste this entire block:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
//prepare title for providers , once global $woe_ast_provider_title; global $wpdb; $woe_ast_provider_title = array(); $woo_shippment_table_name = $wpdb->prefix . 'woo_shippment_provider'; $providers = $wpdb->get_results( "SELECT ts_slug,provider_name FROM {$woo_shippment_table_name} WHERE provider_name IS NOT NULL", ARRAY_A ); $woe_ast_provider_title = wp_list_pluck($providers,"provider_name","ts_slug"); //fill product tracking information add_filter( 'woe_fetch_order_product', function($row, $order, $item, $product, $item_meta ){ global $woe_ast_provider_title; if( class_exists("WC_Advanced_Shipment_Tracking_Actions") ) $st = WC_Advanced_Shipment_Tracking_Actions::get_instance(); elseif( class_exists("AST_Pro_Actions") ) $st = AST_Pro_Actions::get_instance(); else return $row; $tracking_items = $st->get_tracking_items( $order->get_id() ); if( !$tracking_items ) return $row; //we have tracking information for this order $tracking_numbers = array(); $tracking_providers = array(); $shipping_dates = array(); foreach($tracking_items as $tracking_item) { //free version have only global information if( !isset($tracking_item["products_list"]) OR empty($tracking_item["products_list"]) ) { $tracking_numbers[] = $tracking_item['tracking_number']; $tracking_providers[] = isset($woe_ast_provider_title[$tracking_item['tracking_provider']]) ? $woe_ast_provider_title[$tracking_item['tracking_provider']] : $tracking_item['tracking_provider']; $shipping_dates[] = date_i18n( wc_date_format(), $tracking_item['date_shipped']); continue; } // Paid addon "Tracking per items" is active! foreach($tracking_item["products_list"] as $tracked_product) { if($tracked_product->item_id == $item->get_id() ) { $tracking_numbers[] = $tracking_item['tracking_number']; $tracking_providers[] = isset($woe_ast_provider_title[$tracking_item['tracking_provider']]) ? $woe_ast_provider_title[$tracking_item['tracking_provider']] : $tracking_item['tracking_provider']; $shipping_dates[] = date_i18n( wc_date_format(), $tracking_item['date_shipped']); } } } //only set exported columns if( isset($row['tracking_number'])) $row['tracking_number'] = join(",", $tracking_numbers); if( isset($row['tracking_provider'])) $row['tracking_provider'] = join(",", $tracking_providers); if( isset($row['shipping_date'])) $row['shipping_date'] = join(",", $shipping_dates); return $row; },10,5); |
Step 3: Test it
Save the profile. Run a test export on an order with tracking info.
Check your CSV. You should see tracking numbers, provider names, and shipping dates.
What appears in your export
| Order | Product | Tracking Number | Tracking Provider | Shipping Date |
|---|---|---|---|---|
| #1001 | Blue Widget | 1Z999AA10123456784 | UPS | May 19, 2026 |
| #1001 | Red Gadget | 9405510200881234567890 | USPS | May 19, 2026 |
Multiple tracking numbers on one order? They appear together in one cell. Comma-separated.
Which AST versions work
- AST Free: Works. Shows global tracking per order.
- AST Pro: Works better. Shows tracking per individual product.
- AST with “Tracking per items” addon: Fully supported. Each product shows its own tracking.
Common mistake
Using gray meta keys. Gray means built-in WooCommerce fields. Won’t work.
Add GREEN keys only. Type them manually in the text box below the dropdown.
Also, forgetting the first code block (provider titles). That block translates carrier slugs like “ups” into “United Parcel Service”.
Empty columns?
Three things to check:
- Does the order have tracking info in AST?
- Did you add GREEN meta keys exactly as named?
- Is AST plugin active and working?
Enable Debug output in Misc Settings. Look for PHP errors.
Pro tip
Want cleaner output? Replace join(",", $tracking_numbers) with join(" | ", $tracking_numbers). Use pipe symbols instead of commas.
Need only unique tracking numbers? Wrap with array_unique():
$row['tracking_number'] = join(",", array_unique($tracking_numbers));
Real talk
AST stores tracking data in its own database tables. Not in standard WooCommerce meta. That’s why regular exports miss it.
This code pulls directly from AST tables. Works for both free and Pro versions.
Your fulfillment team gets complete tracking info. No more manual copy-paste from order admin screens.