I'm trying to figure out how regionUpdater works in Magento 2. Region Updater is when you select a country, Magento reloads the region field depending on which country was selected.

I went to Magento's Checkout module then saw regionUpdater Javascript file in this path:


I went to my browser and tried to put some breakpoints to it but I cannot see regionUpdater.js is included. I tried many ways to figure out how it is working but cannot understand it.

My purpose is I'm going to implement a **cityUpdater function that help Magento reload the city field based on the region field - the same way as regionUpdater.

2 Answers 2


It seems like the RegionUpdater Class is responsible for this. Check this file: https://github.com/magento/magento2/blob/077584c99ebb8007cad176c3b9a0144a05c259cd/lib/web/mage/adminhtml/form.js#L81

And https://github.com/magento/magento2/blob/077584c99ebb8007cad176c3b9a0144a05c259cd/lib/web/mage/adminhtml/form.js#L187

I don't know how this actually loaded in the frontend. (Haven't played with the new frontend architechure of Magento 2 yet). But what I did is searched for "country_id" which is the name of the dropdown field in the Magento 2 repo on github and filtered on javascript. From there you can see which files have to do with this functionality. Just follow the lead and search for key elements like classnames, function names and html element id's, classes or names.

  • That doesn't seem to answer the question I asked.
    – HungDQ
    Commented Feb 5, 2016 at 7:05
  • How does it work is kinda broad, thats why I answered with some leasds for you to look into further. Could you be a little more specific what you exactly want to know? BTW, did you come across this file too? github.com/magento/magento2/blob/…
    – Akif
    Commented Feb 5, 2016 at 16:36

1) It seems that you have a cache issue, or something like that. Breakpoint on _updateRegion function is working for me. Check source code of the "/customer/address/edit/" page to see params of regionUpdater.

2) Alternative way is to make jquery plugin that will check onChange event and upload needed cities through ajax.

  • Alexy, i have checked magento checkout and at region-updater.js is loaded.So how it load at checkout. have u any idea on it
    – Amit Bera
    Commented Nov 27, 2017 at 15:50

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.