I have 3 subscriptions available on my WooCommerce site. 1 of the subscription plans is Annual Paid Monthly. This essential means a minimum term of 12 month but paid month to month. WooCommerce doesn't natively support this.
What I would like to do is detect if the user is on a particular subscription and if so, hide the cancel button until the subscription is greater than 11 months.
I found this below that hides the cancel button in all cases. I'm looking for a way to check if the subscription is XXX and if so, hide the cancel button instead
/**
* 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' );