Remove Create Account Functionality using Custom Stores Configuration

Blog
Spread the love

Since Magento’s core modules lack the ability to remove create account functionality, we must build a unique store configuration in order to make this dynamic and user-friendly for everyone. So, first start with creating system.xml for creating a store configuration.

Create system.xml File:

In your custom module directory (app\code\Vendor\Module), create a etc\adminhtml\system.xml file. If the etc\adminhtml directory does not exist, create it. This file defines the structure of your system configuration.

Create config.xml File:

In your custom module directory (app\code\Vendor\Module), create a etc\config.xml file. If the etc directory does not exist, create it. This file define the default value of your configuration

Create Provider.php File:

In your custom module directory (app\code\Vendor\Module), create a Model\Config\Provider.php file. If the Model\Config directory does not exist, create it. This file is use to fetch system configuration value

Create di.xml File:

In your custom module directory (app\code\Vendor\Module), create a etc\frontend\di.xml file. If the etc\frontend directory does not exist, create it. This file is used now to fetch to configure plugin

Create RegistrationPlugin.php File:

Now, we need to create an after plugin for the

Magento\Customer\Model\Registration::isAllowed() function. As we can see this function always returns true. In case to remove create account functionality we need to return false when our condition matches.

extention_2023

In your custom module directory (app\code\Vendor\Module), create a Plugin\Model\RegistrationPlugin.php file. If the Plugin\Model directory does not exist, create it.

Run the below commands:

After this, in Magento Admin navigate to Stores -> Configuration -> Customers -> Customer Configuration -> Create New Account Options -> Disable Account Registration and set the value to Yes.

extention_2023

At last Run

Now you see the result on Frontend

Result Before:

extention_2023

extention_2023

Result After:

extention_2023

extention_2023

Note: If you want this for a specific website or store. Update this configuration after changing scope.

Shashi Kant

Shashi Kant

2024-01-08

0

Leave a Reply

Your email address will not be published. Required fields are marked *

Find More Blogs

How to Add a Custom Tab to the Customer Order Detail Page in Magento 2

Spread the love Adding a custom tab to the Order Detail

Exception Handling in Java

Spread the love Introduction – Exception:An unwanted

How to add custom less file in Magento2

Spread the love Source files *.css included into layout

Spring Boot Microservices

Spread the love Microservices architecture has become

Implementation of WireMock for better testing

Spread the love WireMock is a flexible and powerful tool

Magento 2: How to selected default option in configurable options?

Spread the love Configurable products in Magento 2 allow

How To Implement Simple JWT Authentication in Django Rest Framework

Spread the love We’ll learn how to use simple JWT

Optimizing Search: Integrating Elasticsearch in Django Applications

Spread the love What is Elasticsearch? Elasticsearch is a

How to create Customer Segments

Spread the love In Magento 2, “customer

Proxy Design Pattern and Requisition List in Magento 2

Spread the love Requisition List in Magento 2 Requisition

bluethinkinc Blogs