I tried to look for everything on Google but I had little luck.
I created a login and registration form on the same page before making a purchase if you are not logged in.
To log in, use the following code:
$creds = array( 'user_login' => $user_data->data->user_login, 'user_password' => $pwd_login, 'remember' => true ); wp_signon( $creds, false ); wp_redirect( home_url() . '/log-checkout/?prodotto=' . $_GET['prodotto'] ); exit();
Everything works properly and the login is done.
The problem occurs when I go to the next payment page and go back.
When I go back from the payment form to the login / registration form I should no longer see the login / registration form but rather to see which account the user I created is logged in and this works perfectly too.
To view it the user must reload the page again.
How can I make that when the user comes back to see which email is logged in he doesn't have to reload the page to see it?
Is there a simple WordPress function that configures authentication cookies?
Thanks a lot to those who will help me.
PS. For the payment page I use Stripe Checkout.