Skip to content

Instantly share code, notes, and snippets.

@jrick1229
Last active November 29, 2018 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrick1229/c40670db94634f1f3e9688e2c4578422 to your computer and use it in GitHub Desktop.
Save jrick1229/c40670db94634f1f3e9688e2c4578422 to your computer and use it in GitHub Desktop.
Hide the 'Cancel' button from the My Account page with Subscriptions
<?php
function eg_remove_my_subscriptions_button( $actions, $subscription ) {
foreach ( $actions as $action_key => $action ) {
switch ( $action_key ) {
case 'cancel': // Hide "Cancel" button on subscriptions that are "active" or "on-hold"?
unset( $actions[ $action_key ] );
break;
default:
error_log( '-- $action = ' . print_r( $action, true ) );
break;
}
}
return $actions;
}
add_filter( 'wcs_view_subscription_actions', 'eg_remove_my_subscriptions_button', 100, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment