5

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.

8
  • Have you tried to apply the patch at the bottom of the bug report? github.com/magento/magento2/commit/…
    – Joe
    Commented Oct 30, 2017 at 19:29
  • @Joe Yes I tried the changes in that PR with no luck. Those changes are just DOB validation changes, so I'm not sure why they were attached to that bug report.
    – rain2o
    Commented Oct 30, 2017 at 19:41
  • Does the html for the Zip/Phone fields render? (when you view source/inspect-element -- is the html there?) If so, then it's just css that's hiding it and you can add a rule to force it to display. Won't fix the root of the issue, but maybe it can get you by until you have it all figured out.
    – Joe
    Commented Oct 30, 2017 at 19:55
  • Also, are there any js errors in your console? Anything in system.log or exception.log as well?
    – Joe
    Commented Oct 30, 2017 at 20:03
  • @Joe The html is not rendered. The form is built out with Knockout it looks like, and that field is not built out. So Knockout doesn't see it as a field to render for some reason. No console errors or anything relevant in the Magento logs for that matter.
    – rain2o
    Commented Oct 30, 2017 at 20:19

2 Answers 2

11

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.

3
  • Please mark this answer as accepted. Were you able to figure out what was an issue with migration mapping? Commented Jun 13, 2018 at 19:07
  • @TimBezhashvyly I honestly don't remember anymore, but probably not. Unfortunately that project was a rush project and we had to move on to other thing as soon as it was done.
    – rain2o
    Commented Jun 15, 2018 at 13:53
  • This was exactly the issue and fixed our problem. Does anyone know how these get set initially or if there's a way to fix/update without directly updating the db?
    – Erica S.
    Commented Dec 13, 2019 at 23:12
0

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 !!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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