Skip to content

Instantly share code, notes, and snippets.

@dparker1005
Created March 9, 2023 18:54
Show Gist options
  • Save dparker1005/b2707cd9c7f4de6a9c6504c99468db40 to your computer and use it in GitHub Desktop.
Save dparker1005/b2707cd9c7f4de6a9c6504c99468db40 to your computer and use it in GitHub Desktop.
Redirect users from the cancellation page to the Stripe Customer Portal.
<?php
// Copy from below here...
/**
* Prevent users from cancelling their membership or checking out for a new one.
*/
function my_pmpro_redirect_cancel_to_stripe() {
global $pmpro_pages;
if ( ! empty( $pmpro_pages['cancel'] ) && is_page( $pmpro_pages['cancel'] ) ) {
PMProGateway_stripe::pmpro_billing_preheader_stripe_customer_portal();
}
}
add_action('template_redirect', 'my_pmpro_redirect_cancel_to_stripe', 5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment