I would like to change the order of fields when a customer adds an address or edits an existing one in the address book.

Eg: I would like the zip-code field to be ordered before the city field.

Previously I had already handled this by copying the contents from magento-customer/view/frontend/templates/form/edit.phtml and pasting them into my-theme/Magento_Customer/templates/address/edit.phtml.

I can still use this method to completely omit certain fields from the form but I can not control the order of the fields in this way any more.

Do I need to also create a layout file since the new Magento update or something?

3 Answers 3


You can also update sorting customer address field from database table. you will update table customer_eav_attribute field sort_order. update query like below for zipcode show before city.

UPDATE `customer_eav_attribute` SET `sort_order` = '75' WHERE `customer_eav_attribute`.`attribute_id` = 33;
  • Thank you but I would rather not touch the db directly if I can avoid it. This seems like a good way to do it if I can't fix it in another way.
    – Hurrpadurr
    Sep 26, 2021 at 8:18

You should check customer_address_form.xml file, please check if the block which is calling edit.phtml file is cacheable="false"

<block class="Magento\Customer\Block\Address\Edit" name="customer_address_edit" template="Magento_Customer::address/edit.phtml" cacheable="false">
  • It is indeed set to cacheable="false". I haven't touched that file yet. Is that incorrect?
    – Hurrpadurr
    Sep 26, 2021 at 8:10

The reason why the solution in my theme wasn't working, was because a module had been introduced that is also overwriting the edit.phtml.

I changed the order accordingly in the module.

Your Answer

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

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