0

When a new customer registers an account on our site, the registration page simply refreshes and clears the password field, making it look like registration has failed, when in fact it has succeeded. Is there any way to redirect to the login page after a successful registration, with a "thank you for creating an account message?" Using Magento 2.3.2.

Thank you.

1

If you want to redirect your customers to "My Account Page" then go to Stores > Configuration > Customers > Customer Configuration > Login Options > Redirect Customer to Account Dashboard after Logging in > Set "Yes" else if you want to redirect to your custom page then kindly add the following code in your "di.xml".

In [vendor]/[module]/etc/frontend/di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
  <type name="\Magento\Customer\Controller\Account\CreatePost">
    <plugin name="createpost_plugin" type="\[vendor]\[module]\Plugin\CreatePostPlugin" sortOrder="1" />
  </type>
</config>

and kindly create a new file CreatePostPlugin in [vendor]/[module]/Plugin/CreatePostPlugin.php and add the follwing code

<?php
namespace [Vendor]\[Module]\Plugin;
class CreatePostPlugin
{
    public function afterExecute(
        \Magento\Customer\Controller\Account\CreatePost $subject,
        $result)
    {        
       $result->setPath("[route]/[controller]/[action]");               

       return $result;
    }    
}

Thanks and Hope this helps.

| improve this answer | |
0

Thanks for your answer. Magento should have been redirecting to 'My Account' page by default though. Seems there was some kind of email issue. I installed a SMTP extension, and that fixed it. On to the next problem now.....

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.