0

Recently I started to work with Magento Commerce. I tried to add new fields/attributes to Customer Addresses. It is possible in Commerce, on Admin section Store > Attributes > Customer Address. I added two new fields without a problem, but I am dealing with some issues I am not sure how to solve:

1) I could change the sort order of my attribute on admin (Store > Attributes > Customer Address > [MyAttribute], and some default Magento attributes on my custom module file: /view/frontend/layout/checkout_index_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <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="postcode" xsi:type="array">
                                                                    <item name="sortOrder" xsi:type="string">90</item>
                                                                </item>
                                                                <item name="city" xsi:type="array">
                                                                    <item name="sortOrder" xsi:type="string">100</item>
                                                                </item>
                                                                <item name="region" xsi:type="array">
                                                                    <item name="sortOrder" xsi:type="string">120</item>
                                                                </item>
                                                                <item name="country_id" xsi:type="array">
                                                                    <item name="sortOrder" xsi:type="string">130</item>
                                                                </item>
                                                                <item name="telephone" xsi:type="array">
                                                                    <item name="sortOrder" xsi:type="string">140</item>
                                                                </item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

On Checkout Shipping Addresses Form all is working fine:

enter image description here

But in My account New Addresses' Form, that sort order is ignored.

enter image description here

It's also ignored on Checkout Billing Addresses, and also, my custom fields are not present on that form

enter image description here

How can I applied my custom fields and sort order on ALL addresses forms?

Thanks,

Your Answer

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

Browse other questions tagged or ask your own question.