skip to Main Content

Summary

When I try to place an order after the customer registration/Login. Magento 2.3.3 shows "First Name is a required Field Error. Firstname field is not displayed. When I try create shipping address at profile page or at backend – firstname field is displayed but same validation error occured!

Data was migrated from 1.9.3.4 by Data migration tool

I read about same troubles in another versions magento but no solutions found

I try to play with eav_attribute and customer_eav_attribute. I put is_visible=1 and is_required=0 but It not helps

Steps to reproduce

  1. Login
  2. Checkout order
  3. Fill shipping form
  4. Error displayed: Please check the shipping address information. "firstname" is required. Enter and try again.

Screenshots

Place order - firstname is hidden

Profile create shipping address

Backend = customer edit - shipping address add

2

Answers


  1. I have this issue on my end after migration from Magenro 1.9 to magento 2.3.3, for me this way is working :
    run on your mysql command line

    select attribute_id,attribute_code from eav_attribute where
    attribute_code="firstname";

    it will showing like this

    enter image description here

    then run the following query , don’t forget to change attribute_id based on your end:

    INSERT INTO `customer_form_attribute` (`form_code`, `attribute_id`) VALUES ('adminhtml_checkout', '5');
    INSERT INTO `customer_form_attribute` (`form_code`, `attribute_id`) VALUES ('adminhtml_customer_address', '5');
    INSERT INTO `customer_form_attribute` (`form_code`, `attribute_id`) VALUES ('adminhtml_customer_address', '20'); 
    INSERT INTO `customer_form_attribute` (`form_code`, `attribute_id`) VALUES ('customer_address_edit', '5'); 
    INSERT INTO `customer_form_attribute` (`form_code`, `attribute_id`) VALUES ('customer_address_edit', '20');
    INSERT INTO `customer_form_attribute` (`form_code`, `attribute_id`) VALUES ('customer_register_address', '20'); 
    INSERT INTO `customer_form_attribute` (`form_code`, `attribute_id`) VALUES ('customer_register_address', '5');
    
    Login or Signup to reply.
  2. I’ve just experienced this issue after migrating from 1.9 to 2.4.3.

    My solution was to back up the customer_form_attribute table and truncate it (remove all the data).

    mysql> create table customer_form_attribute_bkup select * from customer_form_attribute;
    mysql> truncate customer_form_attribute;
    

    I then placed the following code which I had lifted/amended from vendor/magento/module-customer/Setup/Patch/Data/DefaultCustomerGroupsAndAttributes.php into a file in the root directory of my Magento 2 installation and ran it.

    The customer_form_attribute table was rebuilt and everything worked after that.

    <?php
     
    require __DIR__ . '/app/bootstrap.php';
    $bootstrap = MagentoFrameworkAppBootstrap::create(BP, $_SERVER);
    $app = $bootstrap->createApplication(MagentoFrameworkAppHttp::class);
    
    
    $objManager = MagentoFrameworkAppObjectManager::getInstance();
    $logger = $objManager->get(PsrLogLoggerInterface::class);
    
    $moduleDataSetup = $objManager->get('MagentoFrameworkSetupModuleDataSetupInterface');
    $customerSetupFactory = $objManager->get('MagentoCustomerSetupCustomerSetupFactory');
    $customerSetup = $customerSetupFactory->create(['setup' => $moduleDataSetup]);
    $customerSetup->installCustomerForms();
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search