Developers

This section documents the public PHP API and filter hooks exposed by AST PRO. Use these to integrate AST PRO into custom plugins, shipping software, or site-specific workflows.

Add all code snippets to a child theme’s functions.php or a site-specific plugin — never to the parent theme, which is overwritten on updates.

Functions

FunctionDescription
ast_insert_tracking_number()Add a tracking number to an order programmatically. Signature: ( $order_id, $tracking_number, $tracking_provider, $date_shipped, $status_shipped, $sku = '', $qty = '' ) — note the argument order: number comes before provider.
ast_get_tracking_items()Retrieve all tracking entries for an order. Returns an array of tracking objects.

Filters

FilterArgumentsDescription
woocommerce_email_enabled_customer_completed_order$enabled, $order_id, $orderSuppress the WooCommerce Completed email when no tracking exists on the order.
ast_auto_detection_provider$tracking_provider, $tracking_number, $provider_nameOverride the auto-detected carrier slug using the tracking number or raw provider name.
ast_show_tracking_in_completed_email$show (bool), $orderShow or hide the tracking widget in the Completed order email.
ast_show_tracking_in_shipped_email$show (bool), $orderShow or hide the tracking widget in the Shipped order email.
ast_show_tracking_in_partial_shipped_email$show (bool), $orderShow or hide the tracking widget in the Partially Shipped order email.
wc_ast_default_mark_shipped$checked (int)Set the default state of the Mark as Shipped checkbox. Return 0 to uncheck, 1 to check. Available from AST PRO 5.0.5.
ast_api_create_item_arg$args (array), $request (WP_REST_Request)Modify the arguments array before a tracking item is created via the REST API. Fires on POST /wp-json/wc-shipment-tracking/v3/orders/{id}/shipment-trackings/.
ast_paypal_child_transaction_ids$ids (array), $order_id (int)Add extra PayPal transaction IDs to sync tracking to — used for FunnelKit upsell child transactions.

Where to put the code

  • Add snippets to your child theme’s functions.php or a site-specific plugin. Code added to a parent theme is overwritten on theme updates.
  • Wrap all function calls in an existence check (function_exists() or class_exists()) so the code fails gracefully if AST PRO is deactivated.
  • Test on a staging site before deploying to production.