2

How to remove last name from checkout page in Magento2 ?

  • You will find your solution here, it's what you require. – Aditya Shah May 16 '18 at 9:26
  • Let me know if it works, so i can post an answer :) – Aditya Shah May 16 '18 at 9:34
  • no its not working for me, – shivashankar m May 16 '18 at 10:12
  • in my site there is onstepcheckout module in magento2 – shivashankar m May 16 '18 at 10:13
  • you given the answer link of magento 1.9 – shivashankar m May 16 '18 at 10:13
3
magento\vendor\magento\module-customer\view\frontend\templates\widget\name.phtml
  • Paste above file in-to your theme.

And You will find a class named field-name-lastname remove this complete div for last name. (form theme folder, which you just copied form vendor)

Now run below query in your database to set lastname as optional for customer, because we just deleted the code for lastname.

UPDATE eav_attribute SET is_required = 0 WHERE attribute_code = 'lastname' and `entity_type_id` = 1

and

php bin/magento cache:clean

It's working fine for Magento 2.2.2. Let me know if you have any issue.

3

Run below query into phpMyAdmin

UPDATE eav_attribute SET is_required = 0 WHERE attribute_code = 'lastname' and `entity_type_id` = 1

Please overwrite theme below theme file.

magento\vendor\magento\module-customer\view\frontend\templates\widget\name.phtml

Please remove field-name-lastname from above overwrite theme file.

Clear the cache: php bin/magento cache:clean

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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