Magento 2 has a system in place to facilitate disabling customer registration. The customer module includes a model of which it's the sole purpose to return a boolean
false to indicate if customer registration is allowed. The "Create an Account" link block, the "New Customers" block template (on the Customer Login page) and the Customer Account Create and CreatePost Controllers consult that model and based on it's return value they do or do not display their content.
This model is
* Check whether customers registration is allowed
* @return bool
public function isAllowed()
At first, it seems a bit weird to have a whole class that just returns
true, but this is in place to facilitate a single point where the Magento 2 Enterprise module WebsiteRestrictions can hook into to manipulate the returned boolean value based upon the Website Restrictions configuration you can set in the back end of an Enterprise shop.
You can use that very same construction to disable customer registration on your own in your Magento 2 Community Edition, like the module pointed out in the comments (https://github.com/deved-it/magento2-disable-customer-registration) is also doing. Just create an after Plugin on the
* @param Registration $subject
* @param boolean $result
public function afterIsAllowed(Registration $subject, $result)
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<plugin name="MyStoreCustomerRegistrationDisable" type="MyStore\Customer\Plugin\Customer\Model\RegistrationPlugin" />
Of course you can also introduce a config setting to decide whether to return
false, just like was done in the linked module on GitHub.