Hello every one.
I have an issue with the Customer fields. I try to remove Last Name field on the Register form then I submit the register form but it displays message Last Name is required. I checked at table customer_eav_attribute and empty the validate_rules column of lastname field.
Finally it does not work .
Do you have any suggestion?
Thank you
Go to the 'eav_attribute' table in magento database, Find for the 'lastname' in 'attribute_code' column and find 'is_required' column and set the value to 0 and try ro submit the registration form
Hello @Nguyen Phuc
You need to change below file as well
Magento\Customer\Model\ResourceModel\CustomerRepository.php
if (!\Zend_Validate::is(trim($customer->getLastname()), 'NotEmpty')) { $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'lastname'])); }
Magento\Customer\Model\Customer.php
if (!\Zend_Validate::is(trim($this->getLastname()), 'NotEmpty')) { $errors[] = __('Please enter a last name.'); }
you need to comment above file code.
Go to the 'eav_attribute' table in magento database, Find for the 'lastname' in 'attribute_code' column and find 'is_required' column and set the value to 0 and try ro submit the registration form
If it will work then mark as solution.
But this is working in magento 1.9.For magento 2.1.12,what will be do?
thank u