Make email address not required in magento

Make email address not required in magento

August 7, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Make email address not required in magento

Making Email Address Optional During Magento Registration

If you’re looking to make the email address field optional during Magento customer registration, it is indeed possible, but requires some core file modifications and customization. I’ll guide you through the process step-by-step.

Understanding the Current Setup

By default, Magento 2 requires an email address for customer creation because it serves as the primary identifier for accounts and password reset functionality. Changing this behavior involves altering several core files and classes.

Required Steps

Step 1: Disable Email Validation in Form

The first step is to disable the email validation check in the registration form’s HTML. Open your theme’s vendor/magento/theme-frontend-blank/Magento_Theme/templates/form/element.phtml file and locate this line:

<input type="email" name="<?= $block->getFieldName('email') ?>" id="<?= $block->escapeHtmlAttr($block->getFieldId('email')) ?>"
       value="<?= $block->escapeHtmlAttr($block->getFormDataObject()->getEmail()) ?>"
       data-validate="<?= $block->escapeHtmlAttr($block->getJsValidator()) ?>" />

Change the type attribute from “email” to “text”:

<input type="text" name="<?= $block->getFieldName('email') ?>" id="<?= $block->escapeHtmlAttr($block->getFieldId('email')) ?>"
       value="<?= $block->escapeHtmlAttr($block->getFormDataObject()->getEmail()) ?>"
       data-validate="<?= $block->escapeHtmlAttr($block->getJsValidator()) ?>" />

Step 2: Modify Customer Creation Process

Next, you need to modify the customer creation process in the Magento_Customer module. Open your theme’s copy of the vendor/magento/module-customer/view/frontend/templates/customer/form/register.phtml file.

Locate this line:

<input type="email" class="input-text validate-email required-entry" name="email"
       id="email" value="<?= $block->escapeHtmlAttr($block->getFormDataObject()->getEmail()) ?>"
       data-validate="<?= $block->escapeHtmlAttr($block->getJsValidator('validate-email')) ?>" />

Change the type attribute from “email” to “text”:

<input type="text" class="input-text validate-email required-entry" name="email"
       id="email" value="<?= $block->escapeHtmlAttr($block->getFormDataObject()->getEmail()) ?>"
       data-validate="<?= $block->escapeHtmlAttr($block->getJsValidator('validate-email')) ?>" />

Step 3: Handle Email Field in Backend

The final step involves handling the email field server-side. Open your theme’s copy of the vendor/magento/module-customer/Controller/Account/CreatePost.php file.

Locate this line:

$customer = $this->customerFactory->create(
    [
        'data' => $data,
        'action' => \Magento\Framework\DataObject::INFO_FETCH_ONLY,
    ]
);

Modify the $data array to make the email field non-required:

$data = [
    'group_id' => $customerGroupId,
    'website_id' => $this->storeManager->getWebsite()->getId(),
    // Remove these lines:
    // 'email' => $validatedEmail,
    // 'email_confirmation' => $validatedEmailConfirmation,

    // Add this line (optional, if you have a custom field):
    'username' => $request->getParam('username'),
];

Conclusion

Making the email address optional during Magento customer registration requires modifying several core files and disabling email validation checks. While it’s technically possible, I strongly recommend using an extension or module specifically designed for this purpose.

At Laravel Company, we specialize in Magento development services and offer custom solutions tailored to your specific needs. Contact us today to discuss how we can help you implement this feature safely and efficiently while minimizing the risks associated with core file modifications.

Remember, modifying core files directly is generally discouraged by Magento best practices as it may cause conflicts during updates. Always consider using a module or extension designed for your specific requirements.

Happy customizing!

Magento 2 Themes Email Customers

Our network