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

Custom API to Fetch Customer Data by Customer ID in Spryker

Spread the love Introduction In this blog post, we will

Creating a Custom Module for a Custom Frontend Page in Spryker

Spread the love To create a custom module for a custom

How to create custom module api get category list without access token in Spryker

Spread the love To create a custom API for fetching a

Creating a Custom Glue API in Spryker

Spread the love Spryker’s Glue API is a powerful tool

Get AI Generated 360-Degree View of Account Summary in Dynamics 365 Sales

Spread the love Navigating the demanding landscape of sales

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

bluethinkinc Blogs