Adding new attribute to Customer Account in Magento

I recently discovered that this is a right pig to get going. There’s plenty of “solutions” on the interwebs. Many seemingly either don’t work, don’t work as expected, or are complete hacks which makes your extension not modular (i.e; by executing the “addAttribute” function within a template, then removing it once it’s done).

Here’s how I did it. Testing working in Magento Create the following directory structure;


Create the file app/code/local/BTS/Customer/etc/config.xml;


Create the file app/code/local/BTS/Customer/Model/Entity/Setup.php;

Create the file app/code/local/BTS/Customer/sql/bts_customer_setup/mysql4-install-0.0.1.php;


$installer->addAttribute('customer', 'samples_ordered', array(
    'label'         => 'Number of samples ordered',
    'type'          => 'int',
    'input'         => 'text',
    'visible'       => true,
    'required'      => false,
    'position'      => 9999,


And finally, create the file app/etc/modules/BTS_Customer.xml;


I stopped at this point, as all I needed the new attribute for was for system counting internally. This won't display the attribute on the admin panel though.

Join the Conversation


  1. Hi! Very useful things. It really helped me! I followed the steps you suggested but I have an error for a select field. I added for register form some fields with details. I also used a select and I can’t figure out why it doesn’t work. it doesn’t save my selected value when I register, but then from edit account if i select a value it remains selected. Also from admin, when i create an account, it saves the values for my select field. It doesn’t work only for my register form from frontend. Do you have any idea?
    Thanks so much,

  2. @quizz;
    The code in this article only adds an attribute for programmatic use (within custom extensions, etc). To get this to show up in the admin area, you’ll need to start cloning and modifying the adminhtml template files, as I believe this is fixed and not as dynamic as product attributes are. Categories are the same.
    I’ve not actually had to do anything in terms of putting a custom attribute against a customer and have it displayed in the admin area, so it’s not that I don’t want to help you, it’s that I don’t want to give you incorrect information. However, if I ever do come across a scenario that requires this, I’ll be certain to update this post with the relevant information.
    If, in the meantime, you find out how to do this correctly, please let me know and I’ll post it here with credit to you.

  3. Hi, I need the same functionality to upload file in backend of new customer ? Any help for me ?

Leave a comment

Your email address will not be published. Required fields are marked *