Magento 1.9 – How to Remove Last Name from Checkout Page

checkoutmagento-1.9register

i want to remove middle name & last name on checkout page only. from billing & shipping section. after analyse page code i found that. first/middle/last name coming from a file name.phtml path given below.

frontend/base/default/template/customer/widget/name.phtml

now i am able to remove middle/last name from here (of-course i am not editing core file & made exact path in my theme and paste that file which works OK)

but when i remove it from here. its also removed from registration page. So please tell me exactly what i have to do ?

my magento version is 1.9.X.X

  • My main issue is – when i am commenting last name in file its also removed from registration page

Best Answer

Try this,

Note : Don't Edit Core File Make a copy of Local File then edit

It will remove mandatory fields of First Name & Last Name.

UPDATE eav_attribute SET is_required = 0 WHERE attribute_code = 'lastname'

/app/code/local/Mage/customer/Model/Address/Abstract.php:

 /* if (!Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
         $this->addError(Mage::helper('customer')->__('Please enter the last name.'));
     }
*/

/app/code/local/Mage/customer/Model/Customer.php

/*        if (!Zend_Validate::is( trim($this->getLastname()) , 'NotEmpty')) {
        $errors[] = Mage::helper('customer')->__('The last name cannot be empty.');
    }
*/

/app/code/local/Mage/customer/etc/config.xml

<lastname>
                    <billing>1</billing>
                    <shipping>1</shipping>
                    **<required>0</required>** // change from 1 to 0
                    <mapped>1</mapped>
     </lastname>
Related Topic