Docs Advanced Shipment Tracking Pro (AST PRO) Controlling Tracking Widget in Emails

Controlling Tracking Widget in Emails

By default, AST PRO includes the tracking widget in all Shipped, Partially Shipped, and Completed order emails. Use these filters to hide the widget conditionally — for example, for specific product types, shipping methods, or order metadata.

Available filters

// Completed email
apply_filters( 'ast_show_tracking_in_completed_email', true, $order );

// Shipped email
apply_filters( 'ast_show_tracking_in_shipped_email', true, $order );

// Partially Shipped email
apply_filters( 'ast_show_tracking_in_partial_shipped_email', true, $order );

Parameters

ParameterTypeDescription
$showboolWhether to show the tracking widget. Default: true. Return false to hide it.
$orderWC_OrderThe order object. Use its methods to build conditional logic.

Examples

Hide tracking widget in all Completed emails:

add_filter( 'ast_show_tracking_in_completed_email', function( $show, $order ) {
    return false;
}, 10, 2 );

Hide tracking widget in Shipped emails:

add_filter( 'ast_show_tracking_in_shipped_email', function( $show, $order ) {
    return false;
}, 10, 2 );

Hide tracking widget in Partially Shipped emails for local pickup orders:

add_filter( 'ast_show_tracking_in_partial_shipped_email', function( $show, $order ) {
    // Check whether the order uses a local pickup shipping method
    foreach ( $order->get_shipping_methods() as $shipping_method ) {
        if ( strpos( $shipping_method->get_method_id(), 'local_pickup' ) !== false ) {
            return false; // Hide widget for local pickup orders
        }
    }
    return $show;
}, 10, 2 );

Notes