Docs Advanced Shipment Tracking Pro (AST PRO) Adding tracking info to orders

Adding tracking info to orders

Use ast_insert_tracking_number() to add shipment tracking to a WooCommerce order from PHP — for example, from a custom shipping integration, a cron job, or a webhook handler.

For REST API integration, see the Shipment Tracking REST API reference instead.

Function signature

ast_insert_tracking_number( $order_id, $tracking_number, $tracking_provider, $date_shipped, $status_shipped, $sku = '', $qty = '' )
Note the argument order: $tracking_number comes before $tracking_provider. Swapping them is the most common integration bug — the tracking number is silently saved as the carrier name.

Parameters

ParameterTypeRequiredDescription
$order_idstring|intYesWooCommerce order ID.
$tracking_numberstringYesThe shipment tracking number.
$tracking_providerstringYesCarrier display name — must match an enabled carrier or configured API alias.
$date_shippedstringYesShipment date in YYYY-MM-DD format.
$status_shippedintYes0 = no status change; 1 = mark as Shipped/Completed; 2 = mark as Partially Shipped.
$skustringNoComma-separated product SKUs for per-item tracking.
$qtystringNoComma-separated quantities matching the SKUs above.

Single-package example

Per-item tracking example

Requires Tracking Per Item enabled in General Settings.

Notes