0
Magento 2.4.2-p1
Smartwave Porto theme
extensions from Amasty

We switched to Magento 2.4.2-p1 and the order of the Address fields during check-out is:

First Name
Middle Name/Initial
Last Name
Company
Street Address Street Address: Line 1
Country
State/Province
City
Zip/Postal Code
Phone number

Why is that? I've travelled around the world a lot and I can't think of anywhere where that would make any sense!? We do business in the United States and our customers are from the US. How can we change these to be what the customers are used to? (normal):

First Name
Middle Name/Initial
Last Name
Company
Street Address Street Address: Line 1
City
State
Zip
Country
Phone number

What Bhavin Gohil is suggesting below seems really hard to implement. The checkout_index_index.xml file in:

/public_html/app/design/frontend/Smartwave/porto/Magento_Checkout/layout

Has the following content only:

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <move element="logo" destination="porto_header"/>
    </body>
</page>

Does anyone have a sample checkout_index_index.xml file for US standardised addresses? I searched for hours on the Internet and I feel like I'm trying to re-invent the wheel here! Surely, there are thousands of businesses in the US using Magento who have the address fields right!?! I really can't believe I have waste so much time on this!

1

You have to add content with field name 'sortorder' like:
<item name="country_id" xsi:type="array"> <item name="sortOrder" xsi:type="string">115</item> </item>

In your theme file:
app\design\frontend\<vendor>\<theme>\Magento_Checkout\layout\checkout_index_index.xml:
you have to replace body content:

<body>
    <referenceBlock name="checkout.root">
        <arguments>
            <argument name="jsLayout" xsi:type="array">
                <item name="components" xsi:type="array">
                    <item name="checkout" xsi:type="array">
                        <item name="children" xsi:type="array">
                            <item name="steps" xsi:type="array">
                                <item name="children" xsi:type="array">
                                    <item name="shipping-step" xsi:type="array">
                                        <item name="children" xsi:type="array">
                                            <item name="shippingAddress" xsi:type="array">
                                                <item name="children" xsi:type="array">
                                                    <item name="shipping-address-fieldset" xsi:type="array">
                                                        <item name="children" xsi:type="array">
                                                            <item name="country_id" xsi:type="array">
                                                                <item name="sortOrder" xsi:type="string">115</item>
                                                            </item>
                                                            <item name="city" xsi:type="array">
                                                                <item name="sortOrder" xsi:type="string">112</item>
                                                            </item>
                                                            <item name="postcode" xsi:type="array">
                                                                <item name="sortOrder" xsi:type="string">114</item>
                                                            </item>
                                                            <item name="region_id" xsi:type="array">
                                                                <item name="sortOrder" xsi:type="string">113</item>
                                                            </item>
                                                            <item name="telephone" xsi:type="array">
                                                                <item name="sortOrder" xsi:type="string">116</item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </item>
            </argument>
        </arguments>
    </referenceBlock>
    <move element="logo" destination="porto_header"/>
</body>
6
  • I have updated my original post if you would please take a look? Basically, I only have a few lines of code in /public_html/app/design/frontend/Smartwave/porto/Magento_Checkout/layout/checkout_index_index.xml and I don't feel confident at all regarding what to add into this file. Is there a file already available out there that I could just copy?
    – Allysin
    Oct 13 at 21:19
  • I think the Porto theme has a backend setting for checkout fields sorting. Oct 14 at 8:09
  • and also check the answer Oct 14 at 9:00
  • I have contacted Porto and they replied saying this is a Magento thing and has nothing to do with the Smartwave Porto theme. I will try to upload the file. Thank you.
    – Allysin
    Oct 14 at 15:58
  • This worked for the Shipping address. Thank you! I see it's different for the Billing address... Would you have any idea how to change that?
    – Allysin
    Oct 14 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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