Woocommerce Membership Expiry Date

According to the documentation, wc_memberships_get_user_memberships() returns a list of WC_Memberships_User_Membership objects.

The WC_Memberships_User_Membership class has a get_end_date() method that will return the expiry date.

So you should be able to do something like this:

// Get memberships for the current user.
$memberships = wc_memberships_get_user_memberships();

// Verify that they have some memberships.
if ( $memberships ) {
  foreach( $memberships as $membership ) {
    // Print the expiration date in mysql format.
    echo $membership->get_end_date();
  }
}

The mysql date format is the default, but you can also use something like $membership->get_end_date( 'Y-m-d H:i:s' ) to have custom formatting or $membership->get_end_date( 'timestamp' ) to get the timestamp.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)