benecaster_subscription_free_switch_cancelled
Fires when a scheduled move onto the show’s free plan is withdrawn before it lands. The subscriber’s Stripe subscription is no longer set to end, and they stay on their paid tier. This is the undo signal for benecaster_subscription_free_switch_scheduled: anything you recorded there, undo here.
It fires in two situations, told apart by $reason: the subscriber took the move back themselves (subscriber), or they cancelled their membership outright instead (membership_cancelled). In the second case the usual cancellation hooks follow: benecaster_subscription_cancellation_requested straight away, and benecaster_subscription_cancelled when the paid period ends.
A paused membership does not withdraw the move and does not fire this hook. When the podcaster’s Benecaster license lapses and member billing is paused, a pending move onto the free plan is left in place and still lands at the renewal, because it was the subscriber’s choice. Do not treat a pause as a withdrawal.
A withdrawn move to a paid tier or another billing period fires benecaster_subscription_cadence_switch_cancelled instead. The two are separate because a free move has no price, which is what that hook identifies a switch by. The subscriber’s row has already been cleared when this fires, so re-reading it shows the withdrawal.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$user_id |
int |
— | WordPress user ID |
$show_id |
int |
— | ID of the show |
$to_tier_slug |
string |
— | The free tier they were going to land on |
$reason |
string |
— | `subscriber` or `membership_cancelled`. Treat any other value as withdrawn for an unknown reason rather than ignoring the event. |
Examples
Undo the note made when the move was scheduled
add_action( 'benecaster_subscription_free_switch_cancelled', function (
int $user_id,
int $show_id,
string $to_tier_slug,
string $reason
) {
my_crm_add_note( get_userdata( $user_id )->user_email, sprintf(
'No longer moving to the free plan (%s): %s',
$to_tier_slug,
'membership_cancelled' === $reason ? 'cancelled instead' : 'changed their mind'
) );
}, 10, 4 );
Need this built rather than just documented? See our services →