1. Home
  2. Knowledge Base
  3. WooCommerce Members Only
  4. Set a fixed expiry date
  1. Home
  2. Knowledge Base
  3. Registration
  4. Set a fixed expiry date

Set a fixed expiry date

By default, you can set expiry dates a specific period of time into the future. So a membership role will expire one month, one year, etc from the time of purchase.

If you’d prefer to set a specific date, you’d need to use the following filter:

<?php
/**
* Set fixed expiry date
*/
function prefix_role_expiration_date( $expires, $role, $user_id ) {
$expires = '25 October 2020';
return strtotime( $expires );
}
add_filter( 'wcmo_role_expiration_date', 'prefix_role_expiration_date', 10, 3 );

Here’s how to add a snippet.

Was this article helpful?

Need More Support?

If you can't find the answer that you're looking for, then please use the link below to raise a support ticket.
Contact Support

Related Articles