In this post, we will see how we can add custom attribute to customer model.

Let us say we want to add the attribute registration_city to customer model. For this, create a new file named add_custom.php on the root of your Magento installation.

Now add following code to it:


$installer = Mage::getResourceModel('customer/setup', 'customer_setup');

$installer->addAttribute('customer','registration_city', array(
    'label'             => 'Source State',
    'type'              => 'text',    //backend_type
    'input'             => 'text', //frontend_input
    'global'            =>  Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'visible'           => true,
    'required'          => false,
    'default'           => '',
    'frontend'          => '',
    'unique'            => false,
    'note'              => ''

    ->getAttribute('customer', 'registration_city')
    ->setData('used_in_forms', array(
        'customer_account_create', 'customer_account_edit', 'customer_address_edit',
        'checkout_onepage_register', 'checkout_onepage_register_guest', 'checkout_onepage_billing_address',

Execute the script on browser and the attribute should be added to customer model.