Skip to content

Instantly share code, notes, and snippets.

@jrick1229
Last active July 2, 2020 16:32
Show Gist options
  • Save jrick1229/58b4d7db00489649fecbebbb655b45e2 to your computer and use it in GitHub Desktop.
Save jrick1229/58b4d7db00489649fecbebbb655b45e2 to your computer and use it in GitHub Desktop.
Hide the 'Cancel' button until the payment count reaches '12'.
<?php
function wcs_remove_cancel_button_MIN ( $actions, $subscription ) {
if ( $subscription->get_completed_payment_count() >= 12 ) {
return $actions;
}
unset( $actions['cancel'] );
return $actions;
}
add_filter( 'wcs_view_subscription_actions', 'wcs_remove_cancel_button_MIN', 100, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment