>How to Create Additional Customer Attributes in Magento 2 Enterprise

How to Create Additional Customer Attributes in Magento 2 Enterprise

This blog provides a detailed explanation of customer attributes in Magento 2 which are available on enterprise edition. Unfortunately, the community edition didn’t support customer attribute system yet.

What are Customer Attributes?

Customer attributes are all the information associated with customers and appear as fields in frontend forms. Admin uses this information for customer management and order fulfillment. Depending on your business, you may need to add more fields to the one provided by Magento.

magento 2 customer attributes

How to Create a New Customer Attribute

Go to Stores ⇒ Attributes ⇒ Customer ⇒ Click Add New Attribute button.

Attribute Properties

Add New Customer Attribute

Default Label: Enter name of the attribute.

Attribute Code: Enter the code for an attribute. The code must begin with a letter, use lowercase letters (a-z) and number (0-9), less than 30 characters and use underscore for space (_).

Ex: company_name, position_in_company

Input Type: Decide the type of input (text field, text area…)

Default Value: Enter a default value.

Input Validation: Set the type of data that is correct to enter into the field.

Input/Output Filter: Apply a filter to input type. Choose one of the 3 options:

  • Note: Does not apply a filter to text entered into the field.
  • Strip HTML Tags: Removes HTML tags from the text.
  • Escape  HTML Entities: Converts special characters found in the text to a valid HTML escape sequence

Add to Column Options: Choose Yes to include the column in Customers grid.

Use in Filter Options: Choose Yes to filter the Customers grid by the attribute.

Use in Search Options: Choose Yes to search the Customers grid by the attribute.

Use in Customer Segment: Choose Yes to make the attribute available to customer segments.

Storefront Properties

Storefront Properties customer attribute

Show on Storefront: Choose Yes to make the attribute visible to customers.

Sort Order: Set the order of appearance.

Forms to Use: Include the attribute in the following forms: Customer Registration, Customer Account Edit, and Admin Checkout.

Attribute Labels/Options

Here is a list of default customer attributes. 

default customer attributes

Adding Custom Field in Magento Registration Page

The benefits of using customer attribute to add custom registration fields

Understanding more about your customers help store owner develops a suitable marketing strategy. However, just using the default customer attributes such as first name, last name, email, gender… won’t be enough to fulfill store owner’s request of collecting additional information.

Therefore, you should follow the above guide to create new customer attributes and add them to the Customer Registration page and Customer Account Edit page for easy and effective customer data collection.

Here is an example for you.

Create new customer attributes in the admin panel

Adding custom field in Magento registration page

Enter attribute label, choose input type (text field, text area, multiple lines, date, dropdown, multiple select, yes/no, file attachment, image field), enable to show on the storefront and add the new attribute in Customer Registration and Customer Account Edit.

Specify values for the new attribute

Specify values for the new attribute

Add new options, enter a value then save the attribute.

A new custom field is displayed on Customer Registration page

New custom field is displayed on Customer Registration page

A new custom field is displayed on the Customer Account Edit page

New custom field is displayed on Customer Account Edit page

The custom field value is added to Customer grid.

The custom field value is added to Customer grid

I hope that the tutorial is helpful to you. Please stay tuned for other blogs at BSSCommerce.

Other blogs within the series of Customer and Customer Group knowledge base you might be interested:

How to Manage Customer in Magento 2

A Brief Guide on Customer Configuration in Magento 2

[Updated News]: Customer Attributes for Magento 2 Extension Newly Launched on BSSCommerce

Magento 2 Community Edition didn’t support adding extra customer attributes to Registration Form. This function is only available for Enterprise Edition, so BSSCommerce has newly launched the Customer Attributes extension for Magento 2 to meet the demand of Community users. You can also read this blog to understand the extension better.

Customer Attributes for Magento 2 extension provides all the necessary functions for creating extra fields and add them to any position of the Sign-up Form. Besides 8 different input types, this extension also supports multiple store views when creating new customer-attributes.

magento-2-customer-attributes-extension

MAGENTO 1 EXTENSIONS | MAGENTO 2 EXTENSIONS | WEBSITE DEVELOPMENT SERVICE