In most of the pages in Magento, we can find the "State/Province" before the "Country" field. Since the "State/Province" depends on the country, that is confusing since the customer has go to next field and select the country, and then go back to the previous field and select the state/province.
This is not correct in the most important page in the storefront, the onepage checkout:
And you can also see the wrong order in some pages of the admin panel:
In other pages, like the shopping cart page, the order is correct:
It would be better if the country can be selected first, then the state/province and finally the ZIP/Postal Code (just like the shopping cart page).
Oh yes, that would make SO MUCH sense. This behaviour is really annoying, also in Magento 1 currently. The order should be changed.
I think the order could be based on the "General -> General -> Country Options -> Default Country" store configuration setting.
If the country is United States, then the order should be the one that is currently applied in Magento 1 and Magento 2 (generally the order for checkout forms in USA is Street, City, State, ZIP, Country).
If the country is not United States, I think the order should be the one that is currently discussed on this topic.
This is a great suggestion, Gabriel! Thanks for submitting it - I've scheduled a few retweets and will keep monitoring voting numbers to try and encourage #RealMagento participation on this one.
Thanks for posting! It's indeed confusing for anyone that's not from the US.
This is a really old discussion. I'm not sure which rule follow every country but normally it seems that the default behavior is ok if your sotre works with 1 country only.
If you'll allow multiple countries the order should be (well, in my opinion) the proposed one on this topic.
At the end, the option to configure this will be the best solution for everyone.
@Damian Culotta Great point & I feel best possible scenario that helps EVERYONE is intelligent defauts, but I'd go a little further if most seemless user experience is truly the objective...
In the meantime.. I vaguely remember someone posting a guide on how to do this yourself, and if I remember correctly it was a combination of multiple layout xml, eav attribute and template changes. Anyone have the link saved? If not, I'll try to post it here.
For the people that are wondering - it's quite easy to change the sort order of the shipping address on the checkout, just one layout XML change is needed.
The `sortOrder` attribute of the `country_id` field needs to be set to `null`, so that it properly falls back to the values defined in the `eav_entity_attribute` table (which are set to intelligent defaults).
<item name="country_id" xsi:type="array"> <item name="sortOrder" xsi:type="null"/> </item>
(For the complete XML, check out https://github.com/magento/magento2/issues/6325 )
To see the defaul sort orders, run the following query:
select a.attribute_id, a.attribute_code, b.sort_order from eav_attribute a, eav_entity_attribute b where a.entity_type_id = 2 and a.attribute_id = b.attribute_id;
It's quite odd, the sort order of country is specifically changed (and only country_id), for the checkout shipping form - not entirely sure why, seems like a mistake..
On top of that, the country_id sortOrder for the billing address is hardcoded to 115, so neither changing it in the eav_entity_attribute or layout XML is going to solve it - you'll need to create a plugin or change the entire class with DI. (closed) bug report here: https://github.com/magento/magento2/issues/6325 (code has changed in the meantime, but the problem still exists).