How to create a membership renewal link to be sent by email including auto login

267 Views Asked by At

I am working on a membership site where the emails "Membership ending soon" which is part of WooCommerce membership are not sufficient as we need to be sending 3 emails before the membership expires at 45 days, 30 days and 15 days.

I am working on a system where I will look for memberships expiring at a certain date through the database and will send my own email, creating the personalised emails are not an issue except for creating a link for the customer to click, auto login and renew. When Woocommerce sends a "Membership ending soon" the email includes such a link.

I am able to create a link using the membership ID:

$user_membership = wc_memberships_get_user_membership(67457);
echo esc_url( $user_membership->get_renew_membership_url() ) ;

This returns a link similar to http://example.com/my-account/?renew_membership=67457&_wpnonce=61179e57fe and this does work to renew but forces the user to login first.

Would anyone know how to create the auto-login link for such renewal?

0

There are 0 best solutions below