Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function eg_remove_my_subscriptions_button( $actions, $subscription ) {
- global $wp_query;
- $cat_id = $wp_query->get_queried_object()->term_id; // get current category id
- if($cat_id == 11) { // check if we're in the category
- foreach ( $actions as $action_key => $action ) {
- switch ( $action_key ) {
- case 'change_payment_method': // Hide "Change Payment Method" button?
- // case 'change_address': // Hide "Change Address" button?
- // case 'switch': // Hide "Switch Subscription" button?
- // case 'resubscribe': // Hide "Resubscribe" button from an expired or cancelled subscription?
- // case 'pay': // Hide "Pay" button on subscriptions that are "on-hold" as they require payment?
- // case 'reactivate': // Hide "Reactive" button on subscriptions that are "on-hold"?
- // 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 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement