I have issues on removing the checkout postcode field on a default Magento 2.1 install.
I have tried by adding the componentDisabled
node on the jsLayout
object for the postcode
component:
Created a new module with the following structure:
/
|etc
|___module.xml
|view
|___frontend
|______layout
|_________checkout_index_index.xml
|registration.php
The app/code/<VENDOR>/<MODULE>/view/frontend/layout/checkout_index_index.xml
file contents:
<?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="postcode" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true</item>
</item>
</item>
<item name="postcode_test" xsi:type="array">
<item name="config" xsi:type="array">
<item name="componentDisabled" xsi:type="boolean">true</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</item>
</argument>
</arguments>
</referenceBlock>
</body>
</page>
By inspecting the json returned by $block->getJsLayout()
here, I find that the postcode
node is overwritten by the one on the Magento_Checkout
(this) module and the componentDisabled node from my module isn't used.
I am also noticing that my postcode_test
note appears in this json.
Any help appreciated.