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

Enhancing Productivity with Dynamics 365: The Power of Session Restore

Spread the love Enhancing Productivity with Dynamics 365:

Salesforce Admin

Spread the love In our last blog, we discussed common

Unlocking AI with Spring Boot: Real-World Use Cases and Solutions

Spread the love Artificial Intelligence (AI) has moved from

Enhancing Performance with Reactive Java: A Beginner-Friendly Guide

Spread the love In today’s fast-paced software

Integrating Azure Function with Dynamics 365

Spread the love Signup on azure portal and make sure to

How to Create a Power Apps Component Framework (PCF) with React

Spread the love If youʼve been looking to supercharge your

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

bluethinkinc Blogs