3

Hello Friends I Want to Customize My Checkout Page In Magento 2 and remove extra fields Zip/Postal Country Etc. I Using Magento 2.2.6 Version And My Theme Is Fastest.

I alsoedited checkout_index_index.xml File

Here's the codes

    <?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="component" xsi:type="string">MilkJarCookies_OrderDeliveryDate/js/view/shipping</item>
                                                    <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">1001</item>
                                                                </item>
                                                                <item name="region_id" xsi:type="array">
                                                                    <item name="sortOrder" xsi:type="string">1002</item>
                                                                </item>
                                                                <item name="region" xsi:type="array">
                                                                    <item name="sortOrder" xsi:type="string">1002</item>
                                                                </item>
                                                                <item name="postcode" xsi:type="array">
                                                                    <item name="visible" xsi:type="boolean">false</item>
                                                                </item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
  • after above change, do you run caching and deploy command and then check? – Dhiren Vasoya Dec 25 '18 at 12:39
  • Yes I Run Cache Clean And Deploy Command From SSH Access. – Abdullah Dec 26 '18 at 7:15
3

Try following code:


<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" 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="custom_new_field" xsi:type="array">
                                                                    <item name="component" xsi:type="string">Magento_Ui/js/form/element/abstract</item>
                                                                    <item name="validation" xsi:type="array">
                                                                        <item name="required-entry" xsi:type="boolean">false</item>
                                                                    </item>
                                                                    <item name="sortOrder" xsi:type="string">1105</item>
                                                                    <item name="config" xsi:type="array">
                                                                        <item name="tooltip" xsi:type="array">
                                                                            <item name="description" xsi:type="string" translate="true">Custom New Field</item>
                                                                        </item>
                                                                        <item name="elementTmpl" xsi:type="string">ui/form/element/input</item>
                                                                        <item name="template" xsi:type="string">ui/form/field</item>
                                                                        <item name="customScope" xsi:type="string">shippingAddress.custom_new_field</item>
                                                                    </item>
                                                                    <item name="dataScope" xsi:type="string">shippingAddress.custom_attributes.custom_new_field</item>
                                                                    <item name="provider" xsi:type="string">checkoutProvider</item>
                                                                    <item name="label" xsi:type="string" translate="true">Custom New Field</item>
                                                                </item>
                                                                <item name="postcode" xsi:type="array">
                                                                    <item name="config" xsi:type="array">
                                                                        <item name="visible" xsi:type="boolean">false</item>
                                                                    </item>
                                                                </item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

  • Thanks Your Help But This Not Works For Me. – Abdullah Dec 26 '18 at 7:32
  • @Abdullah this is tested code. Should work. – Sohel Rana Dec 26 '18 at 9:30
  • Dear I Using magento 2.2.6 version can you tell me where thi checkout_index_index.xml File Location Because That file i found there this codes not working even i delete this file but noting happen on checkout page. Please Help Or Suggest Me Any Free Extension For Fix This Issue Advance Thanks – Abdullah Dec 26 '18 at 19:22

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.