Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WooCommerce Memberships : allow renewal for active memberships even before membership expiration.
* Allow membership renewal for active memberships
add_filter( 'wc_memberships_valid_membership_statuses_for_renewal', 'my_valid_membership_statuses_for_renewal' );
function my_valid_membership_statuses_for_renewal( $statuses = array() ) {
$statuses[] = 'active';
return $statuses;
* Add the "Renew" button on memberships lists in members area for non-expired memberships
add_filter( "wc_memberships_members_area_my-memberships_actions", 'my_memberships_actions', 10, 3);
function my_memberships_actions( $default_actions, $user_membership, $object ) {
// Renew : Show not only for expired memberships
if ( ! $user_membership->is_expired() && $user_membership->get_plan()->has_products() ) {
$default_actions['renew'] = array(
'url' => $user_membership->get_renew_membership_url(),
'name' => __( 'Renew', 'woocommerce-memberships' ),
return $default_actions;

This comment has been minimized.

Copy link

commented Nov 29, 2017

I am using your code and it is works well with 1 exception. Custom meta fields are not pre-populating. Is there anything in your code that would need to change to include custom fields?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.