Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@brookjacoby brookjacoby commented May 2, 2016

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

@zakirsajib

This comment has been minimized.

Copy link

@zakirsajib zakirsajib commented Jul 19, 2017

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