Skip to content

Checkout : sortOrder not work in Billing / Shipping address #5849

Open
@parthviroja

Description

@parthviroja

Preconditions (*)

  1. Magento 2.2.3
  2. Make sure Check Money Order method is enabled

Steps to reproduce (*)

  1. Create a module that depends on Magento_Checkout
  2. Inside your module, create the following layout
<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" 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="billing-step" xsi:type="array">
                                            <item name="children" xsi:type="array">
                                                <item name="payment" xsi:type="array">
                                                    <item name="children" xsi:type="array">
                                                        <item name="payments-list" xsi:type="array">
                                                            <item name="children" xsi:type="array">
                                                                <item name="checkmo-form" xsi:type="array">
                                                                    <item name="children" xsi:type="array">
                                                                        <item name="form-fields" xsi:type="array">
                                                                            <item name="children" xsi:type="array">
                                                                                <item name="postcode" xsi:type="array">
                                                                                    <item name="sortOrder" xsi:type="string">999</item>
                                                                                </item>
                                                                            </item>
                                                                        </item>
                                                                    </item>
                                                                </item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>
  1. Flush caches and delete the content of pub/static/frontend/*
  2. Add a product to the cart and go to the checkout

Expected result (*)

  • You should see the postcode field at the very end of the form.

Actual result (*)

  • postcode field is at the very top of the form.

Additional notes

Looking at

\Magento\Checkout\Block\Checkout\LayoutProcessor::process() 

I can see the postcode inside jsLayout object

But looking at its sortCode it contains an array with two values.
One coming from the customer_eav_attribute table and the other coming from layout layout.

I think it should return a string containing the layout value that replaces the value from the db.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Cart & CheckoutComponent: CheckoutIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itbug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions