0

I want to auto fill state and City. When i enter zip code in magento 2 checkout shipping address.

closed as too broad by Piyush, Mohit Kumar Arora, liyakat, Manashvi Birla, Murtuza Zabuawala Jul 24 '18 at 10:10

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

This functionality doesn't come out of box with Magento 2 but you can implement this. You'll need to add all the pincodes in a table with State and City name.
You might get this list online or APIs are also available to do so.
I'll prefer to store this data on your database as this will be a constant information and will give you better performance and control.
Then create a ajax controller to return city and state information based on given pincode which you can fetch from db or API.
Write js function to update the form.

I hope this will be helpful.
Let me know if you stuck somewhere in implementation.

1

There is a plugin called Wezz Postcodem2 (https://github.com/wezzco/postcode-m2) but that one only works for addresses in the Netherlands.

You could look into Google Address Magento 2 plugins but as i have seen most of them support only auto completion for Streetname. I haven't looked to far into it so maybe it does have some kind of possibility for the function you want.

  • Can you please give me link of Wezz Postcodem2? – Magecode Apr 30 at 11:59
  • @Magecode I added the link. – Sanne May 1 at 12:05
  • Thank you so much – Magecode May 2 at 13:10

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