Skip to main content

Suppress or customize the built-in tier change email per tier pair

Free Intermediate Since v1.0.0

The tier change email fires on every benecaster_subscription_tier_changed action — both bridge-initiated and admin-initiated. Use type-specific filters to suppress it for specific tier combinations or to add tier-specific merge tags. old_tier_name and new_tier_name are pre-populated in $tags from the tier map when the tier-specific filter fires.

Code

<?php
// Suppress the email when the subscriber moves to the free tier (downgrade only).
add_filter( 'benecaster_email_should_send_tier_change', function ( bool $should_send, ?int $user_id, ?int $show_id ): bool {
    // Simple example: suppress all tier change emails for a specific show.
    if ( $show_id === 42 ) {
        return false;
    }
    return $should_send;
}, 10, 3 );

// Add a custom merge tag available in the tier-change template only.
add_filter( 'benecaster_email_merge_tags_tier_change', function ( array $tags, ?int $user_id, ?int $show_id ): array {
    $tags['support_url'] = 'https://example.com/support';
    return $tags;
}, 10, 3 );

View on GitHub →

Hooks Used

  • benecaster_email_should_send_tier_change
  • benecaster_email_merge_tags_tier_change