Magento Customer Configuration set up Gender options

Magento Customer Configuration set up Gender options

August 10, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento Customer Configuration set up Gender options

Configuring Gender Options for Magento Customer Registration

Adding gender options to your Magento customer registration form allows you to collect more detailed information about your users. However, many store owners face challenges when trying to set up this feature correctly.

In this guide, we’ll walk you through the steps required to add gender options to your Magento 2 registration form. We’ll cover both the admin panel configuration and the necessary code changes needed for the options to appear correctly on the frontend.

Step 1: Configuring Gender Options in the Admin Panel

Firstly, log into your Magento admin panel. Navigate to System > Configuration.

In the left-hand menu, under the Customers section, click on Customer Configuration. Then, scroll down until you find the Name and Address Options field set.

Look for the Show Gender option. If it’s currently set to No, change it to either Required or Optional.

Save your configuration changes by clicking the Save Config button at the top of the page.

At this point, you might expect to see gender options appear on your frontend registration form. However, if you navigate to your website and check the customer registration page, you’ll likely find that the gender dropdown is empty—no male or female options are available.

This issue occurs because Magento doesn’t automatically populate the gender options when you enable this feature in the admin panel. You need to manually add them through a custom extension.

Step 2: Adding Gender Options via Custom Extension

To add gender options, you’ll need to create a new module in your Magento installation. Here’s a step-by-step guide:

  1. Navigate to your app/code directory and create a new folder for your custom module (e.g., Company_CustomGender).

  2. Inside the new module folder, create the following files and directories:

    • etc/module.xml
    • registration.php
    • view/frontend/templates/registration.html
  3. Open the etc/module.xml file and add the following content:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Company_CustomGender" setup_version="1.0.0">
        <sequence>
            <module name="Magento_Theme"/>
        </sequence>
    </module>
</config>
  1. Open the registration.php file and add the following content:
<?php

namespace Company\CustomGender;

use Magento\Customer\Model\Customer;
use Magento\Framework\App\Bootstrap;
use Magento\Framework\ObjectManagerInterface;
use Magento\Store\Model\StoreManagerInterface;

class Registration
{
    public function beforeCreate(Customer $customer, StoreManagerInterface $storeManager)
    {
        if ($customer->getGender() === null) {
            $customer->setGender('male');
        }
    }
}
  1. Open the registration.html file and add the following content:
<div class="field gender required">
    <label for="gender" data-bind="i18n: 'Gender'" class="label"></label>
    <div data-bind="scope: 'form_data.gender'">
        <input type="radio" data-bind="attr: {value: 1}, checkedValue: 1"
               name="gender" id="gender_female">
        <label for="female">Female</label>

        <input type="radio" data-bind="attr: {value: 2}, checkedValue: 2"
               name="gender" id="gender_male">
        <label for="male">Male</label>
    </div>
</div>
  1. Save all the changes and clear your Magento cache.

Step 3: Enabling Your Custom Module

To enable your custom module, navigate back to the admin panel.

Go to Stores > Configuration > Advanced. In the Advanced field set, under Disable Modules Output, you’ll find a list of disabled modules.

Look for your new module (Company_CustomGender) and select Yes in the Enabled column. Click Save Config.

Conclusion

Adding gender options to your Magento customer registration form requires a combination of admin panel configuration and custom extension development.

First, configure the gender options in the admin panel under Customer Configuration. Then, create a new module that overrides the default registration.html file with your custom template containing male and female radio buttons.

Remember to clear your cache after making these changes. Your updated customer registration form should now include working gender options for both male and female selections.

If you found this guide helpful, please consider sharing it on social media or visiting Laravel Company for more Magento tutorials and resources.

Happy coding!

Magento 2 Admin Configuration Customers

Our network