---
title: "How to Make User Register but not Login in Magento 2.4?"
url: "https://magecomp.com/blog/make-user-register-but-not-login-in-magento-2-4/"
date: "2021-06-21T16:12:40+00:00"
modified: "2025-02-20T08:55:21+00:00"
author:
  name: "Dhiren Vasoya"
  url: "https://magecomp.com/"
categories:
  - "How To"
  - "Magento 2"
word_count: 254
reading_time: "2 min read"
summary: "Hello Magento Friends,"
description: "Default Magento automatically logs in user after registration. Conversely, if you want the user to redirect to the login page after registration follows the ..."
keywords: "How To, Magento 2"
language: "en"
schema_type: "Article"
related_posts:
  - title: "How to Display Tier Price at Category Page in Magento 2"
    url: "https://magecomp.com/blog/display-tier-price-at-category-page-magento-2/"
  - title: "How to Send Product Images in Order Transaction Mail to Customers in Magento 2"
    url: "https://magecomp.com/blog/send-product-images-in-order-transaction-mail-to-customers-magento-2/"
  - title: "How to Show Product Custom Option into Custom Page in Magento 2 "
    url: "https://magecomp.com/blog/show-product-custom-option-into-custom-page-magento-2/"
---

# How to Make User Register but not Login in Magento 2.4?

_Published: June 21, 2021_  
_Author: Dhiren Vasoya_  

![How to Make User Register but not Login in Magento 24](https://magecomp.com/blog/wp-content/uploads/2021/06/How-to-Make-User-Register-but-not-Login-in-Magento-24-1024x512.webp)

**Hello Magento Friends,**

Today I will provide the solution for How to Make User Register but not Login in Magento 2.4?
[![Magento version upgrade](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Version-Upgrade-CTA-1.webp)](https://magecomp.com/services/magento-upgrade-services/)

In default Magento, when the customer registers, they are not asked for login. The user gets automatically logged in after registering.
After registration, the customer must be redirected to the login page instead of automatic login. To accomplish this follow the below step.
## Steps to Make User Register but not Login in Magento 2.4:
**Step 1:** Create a file in your extension along with the plugin at the below-mentioned path
**app\code\Vendor\Extension\Plugin\Customer\Account\CreatePost.php**

Now, add the below code
```
<?php

namespace VendorExtensionPluginCustomerAccount;

use MagentoFrameworkControllerResultRedirectFactory;
use MagentoFrameworkAppResponseRedirectInterface;
use MagentoCustomerModelSession;

class CreatePost
{
    protected $resultRedirectFactory;

    protected $redirect;

    protected $customerSession;

    public function __construct(
        RedirectFactory $redirectFactory,
        RedirectInterface $redirectInterface,
        Session $customerSession
    ) {
        $this->resultRedirectFactory = $redirectFactory;
        $this->redirect = $redirectInterface;
        $this->customerSession = $customerSession;
    }

    public function afterExecute(MagentoCustomerControllerAccountCreatePost $subject, $result)
    {
        if ($this->customerSession->getRegisterSuccess()){
            $lastcustomerId = $this->customerSession->getCustomerId();
            $this->customerSession->logout()->setBeforeAuthUrl($this->redirect->getRefererUrl())
                ->setLastCustomerId($lastCustomerId);

            /** @var MagentoFrameworkControllerResultRedirect $resultRedirect */
            $resultRedirect = $this->resultRedirectFactory->create();
            $resultRedirect->setPath('customer/account/login');
            $result = $resultRedirect;
        }
        return $result;
    }
}
```

That’s it!
[![Magento Malware Removal](https://magecomp.com/blog/wp-content/uploads/2023/04/Magento-Malware-Removal-CTA-1.webp)](https://magecomp.com/magento-malware-removal.html)

## Conclusion:
Simple as that, this way you can Make User Register but not Login in Magento 2. Mention your difficulties in the comment box. Share the article and stay connected with us.
[![Magento 2 Speed & Performance Optimization Services](https://magecomp.com/blog/wp-content/uploads/2025/02/Magento-2-Speed-Performance-Optimization-Services-CTA-1.webp)](https://magecomp.com/magento-performance-optimization.html)

**Happy Coding!**


---

_View the original post at: [https://magecomp.com/blog/make-user-register-but-not-login-in-magento-2-4/](https://magecomp.com/blog/make-user-register-but-not-login-in-magento-2-4/)_  
_Served as markdown by [Third Audience](https://github.com/third-audience) v3.5.3_  
_Generated: 2026-10-08 09:06:57 UTC_  
