I've added two custom attributes for customer registration page (Alternate email & Alternate number) in a new module (through : app/code/.../Setup/InstallData.php).

I have designed its 'view' inside a custom theme (by overriding register.phtml). I can now see new fields on the registration page. However the data inside new fields (alternate email and number) is not getting saved inside database.

'customer_entity_int' saves '0' value.. 'customer_entity_varchar' saves nothing..

enter image description here

Here in the screen you can see the value is saved as '0'. The attribute_id 132 is for 'Alternate Contact Number' on the registration page. So I expect the value to hold the data which I'm entering on the frontend registration page.

What am I doing wrong ?

  • Did you add customer attributes using custom extension ? Apr 6, 2017 at 11:04
  • I added it through a custom module (app/code/.../Setup/InstallData.php) and made it's 'view' through a customized new theme by overriding the 'phtml' file..
    – Kartik
    Apr 6, 2017 at 11:46
  • Before saving the data.. print the model and check if your values are there. Apr 6, 2017 at 11:47
  • Did you reindex and clear cache ? Apr 6, 2017 at 11:53
  • If its still show proper values after printing the model try to log the query and check how the query is getting generated and see if your values are there in that query. To do that open to app/etc/di.xml ... search for Quiet, You will find only 1 occurrence and change that to File. Now open the file Magento\Framework\DB\Logger\File and set $logAllQueries to true. and refresh the browser and open the generated file var/debug/db.log. Find your query and check the query. Apr 6, 2017 at 11:55

4 Answers 4


You have probably solved your issue but for people who come here from google as me, there is a solution:

When creating the customer attribute, please take care of the following things:

Attribute is added to the attribute set, group


Attribute is assigned to customer forms


And the last one the most important as somehow, people just skip over it and wondering why the customer attribute does not want to save from the backend: Please make sure to set "is_system" flag in "customer_eav_attribute" table to 0, otherwise the attribute will not be saved.

It can be done by setting the attribute option to "system" => 0 in attribute parameters inside the install/upgrade script.

Don't forget to flush your cache after all!

Solution URL:

direct link to solution

  • i can save attribute by is_system = 0, but can you let me know why we need to make it 0? as its 1 by default in table Dec 7, 2018 at 4:39
  • 1
    @bhargav shastri, because is_system attribute belongs to Magento
    – user2804
    Mar 13, 2019 at 11:16
  • yes i got it thanks Mar 13, 2019 at 13:30
  • Superb! Thanks kudos! Aug 26, 2020 at 13:11

For anyone will be here searching for the solution. I had the same issue and this comment worked for me.

To avoid this you must specify additional parameters for the attribute.

  • attribute_set_id
  • attribute_group_id
    $attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'customer_code')
                'attribute_set_id' => $attributeSetId,
                'attribute_group_id' => $attributeGroupId,
                'used_in_forms' => ['adminhtml_customer'],

Please follow the below URL:

Anyone searching for the solution. I had the same issue & this below URL worked for me.....



A.Maksymiuk's answer worked like a charm. Here the SQL scripts (MySQL/Maria DB) I've created in order to fix the issue with my attribute:

# Sets up attribute_id to be changed
select @ATTRIBUTE_ID := attribute_id from eav_attribute where attribute_code  = 'attribute_code';

# Refence attribute_id to be used to create the group (here customer email) 
SELECT @REFENCENCE_ATTRIBUTE_ID := attribute_id FROM eav_attribute where entity_type_id = 1 AND attribute_code = 'email';

# Verifies it exists in the customer table
SELECT * FROM customer_eav_attribute WHERE attribute_id = @ATTRIBUTE_ID;

# Fixes is_system issue
UPDATE customer_eav_attribute SET is_system = 0 WHERE attribute_id = @ATTRIBUTE_ID;

# Fixes group issue using same values as the customer email attribute
INSERT INTO eav_entity_attribute 
SELECT null, entity_type_id, attribute_set_id, attribute_group_id, @ATTRIBUTE_ID, 100
FROM eav_entity_attribute 



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.