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

Customize lead qualification for a seamless experience

Spread the love When the 2024 Release Wave 2 was launched,

Create a Custom Console Command in Spryker

Spread the love In Spryker, developers can create custom

SALESFORCE

Spread the love Salesforce is a cloud-based software

CRUD Operation in Spryker Backoffice with a Custom Module

Spread the love Spryker is a highly flexible and modular

How to create custom module on Spryker for Backoffice?

Spread the love Creating a custom module in Spryker

How to Install Spryker Project with Docker on Local Machine

Spread the love Spryker is a flexible and scalable commerce

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

bluethinkinc Blogs