Magento – Magento 2.1.2: How to remove billing address lastname field and shipping address lastname field

billing-addressmagento-2.1.2magento2shipping-address

In Magento 2.1.2

How to remove billing address lastname field and shipping address lastname field ?

I update to eav_attribute table.
UPDATE eav_attribute SET is_required = 0 WHERE attribute_code = 'lastname' and entity_type_id = 1;
and I removed vendor/magento/module-customer/view/frontend/templates/widget/name.phtml

The lastname is valid, but the billing address and the delivery address are invalid.

Does anyone know this ?

Best Answer

If you are using the Magento Onepage Checkout, I believe this is going to fall under a js file.

Checkout -> view -> frontend -> web -> js (folder)

You can start with checkout-data.js but you will also have to modify corresponding files (files that are passed the billing address last name and shipping address last name fields) if you want it completely removed from the app (meaning not throwing a "This is a required field." error)

It may be easier to try and find an extension that can do this for you.