Skip to main content

Send subscribers to a custom resume page on the cancellation confirmation

Premium Beginner

When a subscriber requests cancellation through the built-in billing portal, Benecaster sends a cancellation_confirmation email whose Resume CTA defaults to the subscriber account page. Hook this filter to redirect subscribers to a deeper URL: an anchor that auto-scrolls to the Resume button, a saved-cart-style page in a companion plugin, or a fully custom self-service resume flow.

The full subscription row is passed as the fourth argument so you can build per-plan or per-status URLs when needed.

Code

<?php
add_filter(
	'benecaster_cancellation_confirmation_resume_url',
	function ( string $default_url, int $user_id, int $show_id, array $subscription ): string {
		// Deep-link to the billing-portal Subscription section on the account
		// page. The account template's inline JS can watch for #resume-{show}
		// and auto-scroll + focus the Resume button.
		return add_query_arg( 'show_id', $show_id, $default_url ) . '#resume-' . $show_id;
	},
	10, 4
);

View on GitHub →

Hooks Used

Need this built rather than just documented? See our services →