skip to Main Content

I recently discovered the site I am developing in Magento 2 is missing the Postcode field in the Shipping Address form on the checkout page. I have been digging around and cannot find any reason why it is missing. I found this bug someone opened with Magento but the solution mentioned does not work for me. The results I am seeing are the same though.

On /checkout/ in the Shipping tab the Postcode field is missing. But I am able to continue to the next step. However when I try to complete the checkout I get the error An error occurred on the server. Please try to place the order again. which I believe is because the address has no zip code. This is while checking out as a guest. I have tested checking out as a customer who already has an address saved and that lets me complete the checkout.

I have disabled all modules and returned to using the Luma theme for testing and I am seeing the same results. Unfortunately upgrading to 2.2 isn’t an option at the moment as we are dangerously close to launch so we will have to update after launch. So I don’t know if that update will fix this issue or not.

Magento CE 2.1.8

PHP 7.0.24

If anyone has any guidance or suggestions on how to find my missing field I would greatly appreciate it.

EDIT

The Phone number field is missing as well. While that isn’t as much of a concern, it is probably missing for the same reason.

Also, I just realized that the data migration from our old site (1.9.3) seems to have caused the issue. I tested our new site with a DB before and after the migration and that is what caused us to lose the postcode field. Our data migration only contains Sales data and Customers – no products or categories. I’m digging in now to see what would have caused it. I have tried a reindex multiple times and that didn’t solve it.

2

Answers


  1. Chosen as BEST ANSWER

    Well I found the culprit. When we ran our data migration it seems that the tables eav_form_element and customer_form_attribute lost some information during the migration. The attributes got a little shuffled up. The quick fix was to add in the missing postcode and phone number fields into the appropriate tables. I still need to go back and figure out where I went wrong in the migration configuration.


  2. Run these two queries into database, will fix the problem.

      INSERT INTO `customer_form_attribute` (`form_code`, `attribute_id`) VALUES 
       ('adminhtml_customer_address', '33'), ('customer_address_edit', '33'), 
       ('customer_register_address', '33'), ('adminhtml_customer_address', '34'), 
       ('customer_address_edit', '34'), ('customer_register_address', '34');
    
    
      INSERT INTO `eav_form_element` (`element_id`, `type_id`, `fieldset_id`, 
       `attribute_id`, `sort_order`) VALUES (NULL, '1', NULL, '33', '7'), (NULL, '2', 
        NULL,'33', '7'),(NULL, '3', NULL, '33', '6'), (NULL, '4', NULL, '33', '6'),
        (NULL, '1',NULL, '34', '9'), (NULL, '2', NULL, '34', '9'),
        (NULL, '3', NULL, '34', '8'), (NULL,'4', NULL, '34', '8');
    

    after that run deploy command

    php bin/magento setup:static-content:deploy -f

    hope this will help you to fix the issue

    Happy Coding !!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search