I created three custom field in customer account edit page and same field created in admin panel inside customer edit form.

But now, how to save data? I tried to override the editPost.php file and use this $customer->setCustomAttribute('abc',$this->getRequest()->getParam('ABC'));

This is not help in saving data and show undefine variable "customer" error.

Notice: Undefined variable: customer in /opt/lampp/htdocs/magento/app/code/xxx/xxx/Controller/Account/EditPost.php on line 140
  • create fields using custom attribute , so these value will save by model
    – BornCoder
    Commented Feb 7, 2017 at 11:33
  • how to create field by custom attribute in frontend. and i am using community edition, so there is no feature of creating customer attribute in admin panel. i created that attribute by installdata.php
    – sam
    Commented Feb 7, 2017 at 11:36
  • @sam: did you understood how to save additional data? I'm experiencing the same trouble. Thanks, Ale
    – Ale
    Commented Jun 5, 2017 at 15:40
  • @Ale, yes i understood. please see my answer.
    – sam
    Commented Jun 6, 2017 at 9:13

2 Answers 2


Create customer attribute in installer script by following this link.

These will help you in creating attribute for frontend.

  • i created custom attribute like this only. and data is saved also in admin panel, my question is , on fronted , customer account information page, i created field, from there how to save the data?
    – sam
    Commented Feb 7, 2017 at 12:19
  • you don't need to create fields in frontend , they will come with this code: 'used_in_forms' => ['customer_account_create','adminhtml_checkout','adminhtml_customer'],
    – BornCoder
    Commented Feb 7, 2017 at 13:25
  • No it is not coming. by this code it is coming only in admin panel
    – sam
    Commented Feb 7, 2017 at 13:34

I created some custom field in customer account edit page, and i saved their value in database by editing editpost.php file.

  1. Please don't change the default file, so first overide that file in your custom module

  2. then in execute function , under try, put these code

suppose that i created one field "myname" on frontend in edit form, and one field "name" in admin panel edit form. in database, the column name is also should be "name" then the code will be;


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.