Skip to content

Instantly share code, notes, and snippets.

@bekarice
Last active February 4, 2019 22:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bekarice/bafd0c6fc06157138b8a to your computer and use it in GitHub Desktop.
Save bekarice/bafd0c6fc06157138b8a to your computer and use it in GitHub Desktop.
Remove "My Memberships" actions with WooCommerce Memberships
<?php
/**
* Only copy the opening php tag if needed
*/
function sv_edit_my_memberships_actions( $actions ) {
// remove the "Cancel" action for members
unset( $actions['cancel'] );
return $actions;
}
add_filter( 'wc_memberships_members_area_my-memberships_actions', 'sv_edit_my_memberships_actions' );
add_filter( 'wc_memberships_members_area_my-membership-details_actions', 'sv_edit_my_memberships_actions' );
@brookjacoby
Copy link

Where do you place this code (or php file) to make it work?

@zakirsajib
Copy link

How to programatically cancel the membership?

For example I have two memberships one for trial and another for upgrade. If user upgrade the then automatically the trial memberships will be cancelled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment