With PaddlePress Pro 2.3, you can now add a custom action button related to payments. For instance, if you prefer that customers not cancel their subscriptions directly from the “My Account” page, you can instead add a button that directs them to a cancellation form. This allows you to gather feedback and manually process cancellation requests. PaddlePress makes it easy to handle these situations effectively.
Let’s add a custom “Cancellation Request” button:
add_action( 'paddlepress_my_account_before_payment_action', 'add_custom_cancellation_button', 10, 3 );
function add_custom_cancellation_button( $payment, $settings, $membership_post_id ) {
$url = add_query_arg(
[
'payment_id' => $payment->id,
'subscription_id' => $payment->subscription_id,
],
home_url( '/cancel-subscription/' )
)
?>
<a href="<?php echo esc_url( $url ); ?>" class="btn button">
<?php esc_html_e( 'Cancellation Request', 'paddlepress' ); ?>
</a>
<?php
}
(alternatively you can use paddlepress_my_account_after_payment_action
hook)
Next, disable self service subscription cancellation feature from PaddlePress settings:
And now you can see a custom cancellation button that works like you want: