Controlling Tracking Widget in Emails

Merchants have requested the ability to hide or customize the tracking information shown in WooCommerce emails. By default, AST PRO automatically includes the tracking widget in emails, which can sometimes confuse customers.

Instead of adding a UI setting, we provide developer filters to programmatically control the widget display.

Filters

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

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

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

Parameters

  • $show_tracking (bool) – Default: true. Determines whether the tracking widget is displayed.
  • $order (WC_Order) – WooCommerce order object, allowing conditional logic based on order details.

Default Behavior

  • Completed email: tracking widget appears.
  • Shipped email: tracking widget appears.
  • Partial Shipped email: tracking widget appears.

Returning false from a filter will hide the widget in the corresponding email type.

Developer Usage Examples

Hide tracking in Completed email:

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

Hide tracking in Shipped email:

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

Hide tracking in Partial Shipped email for local pickup:

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

Notes for Developers

  • Returning false from a filter skips injecting the tracking widget in the corresponding email.
  • Other email types remain unaffected.
  • Compatible with HPOS, WooCommerce Email Customizer, and custom email templates.
  • Maintains translatable strings and layout consistency.
  • Safe and backward-compatible; no PHP warnings or notices.

$129.00

Billed annually

Buy Now