In Magento 2, the customer grid by adding custom attributes allows you to display additional information about your customers directly in the admin panel. With Magento 2 users can add custom attribute fields to key sections such as the Address Book, Account Information, Billing Information, and more. Customer attributes are applicable not only during checkout for billing information but also when guests register within their customer accounts.
A Step-by-Step Guide to Add Custom Attributes to Magento 2 Customer Grid
Step 1
When customers sign up on your Magento 2 online store, they typically provide basic information like their first name, last name, and email address. However, Magento 2 offers the flexibility to enhance this registration process by allowing you to add custom attributes to the customer form.
If you're using Magento 2 Commerce Version, you have to create new fields directly from the administration panel, allowing you to gather additional information from your customers during registration.
Here's a step-by-step guide on how to Add custom attributes to the Magento 2 customer grid
- Navigate to Customer Attributes:
- Add New Customer Attribute:
- Configure Attribute Settings:
- Display Attributes in Customer Grid:
Go to the appropriate section in your admin panel to access customer attributes settings. This may depend on your Magento version and configuration.
Select the option to add a new customer attribute. Provide relevant details such as attribute code, label, input type, and any other necessary configurations.
Customize attribute settings as per your requirements, ensuring it align with the information you wish to collect from customers during registration.
After adding the custom attributes, ensure they are displayed in the Customer Grid for easy access and management.
Step 2
Access the admin panel and navigate to create a grid in Magento 2 by right-clicking on the menu. Proceed to "Stores" and then select "Customer Attributes" under attributes. Review the list of existing Magento 2 customer attributes and disable any attributes that are already present. If the desired attribute is not available, click on "Add New Attribute."
In the attribute creation form, specify the field's name under "Default Label" and assign a unique attribute code. Choose from various input types based on your requirements:
- Text Field: For single-line text input.
- Multiple Lines: For multiline text input, accommodating 2 to 20 lines of data.
- Default Value: Set initial values for the field.
- Text Area: Provides an area for multiline input without line breaks.
- Date: Displays a date field with a popup calendar.
- Multiple Selection: Enables the selection of multiple values simultaneously.
- Drop-down: Presents a dropdown list for single-value selection.
- Yes/No: Allows users to choose between "yes" and "no."
Complete additional attribute settings:
- Default Value
- Values Required
- Input Validation
- Input/Output Filtering
If a customer attribute is integrated into the forms used by customers on your e-commerce website, it's essential to complete the settings in the storefront properties section. This ensures that the attribute functions properly within the customer-facing interface. Within these settings, you can specify where and when the attribute appears.
Show on Customer Grid :- Set Yes to show the Customer Attribute as new column on Customer Grid.
Visible in Customer Grid :- Set Yes to make the Customer Attribute value visible on Customer Grid.
Filterable on Customer Grid :- Set Yes to make the Attribute filterable on Customer Grid.
Searchable on Customer Grid :- Set Yes to make the Attribute searchable on Customer Grid.
Step 3
Manage Labels
Default Store View :- Customer can select drop-down option the they want to add option in store view.
Step 4
See result after the addition of customer attributes.
Create Account Page :
On Account Information Page Attribute display in Additional Info block.
Also read:- How to Create Customer Attribute in Magento 2
Conclusion:
With the Magento 2 Customer Attributes extension, merchants can seamlessly enhance their checkout and registration processes by incorporating custom fields. These attributes are not only visible on the backend grid but also offer a user-friendly interface for effortless management. The extension provides flexibility in attribute creation, with customizable conditions for displaying fields. Attribute information is prominently showcased across various customer touchpoints, including the Create Account Page, Account Edit Page, Shipping & Review Page, ensuring a cohesive and personalized user experience.