3

I tried to disable the country field in checkout but i can't.

I already disable few fields like company on checkout page by adding this this

<item name="visible" xsi:type="boolean">false</item> code in module_checkout/layout/checkout_index_index.xml.

<item name="company" xsi:type="array">
   <item name="visible" xsi:type="boolean">false</item>
    <item name="validation" xsi:type="array">
     <item name="min_text_length" xsi:type="number">0</item>
    </item>
</item>

If i try to do the same thing for country filed, this field dosen't disappear.

Does anyone know if it's any other solution for disable this field?

  • 1
  • i already add <item name="visible" xsi:type="boolean">false</item> for disable the filed, and it's not working. – Alin Lupoiu Feb 17 '17 at 8:03
  • Did You add <item name="componentDisabled"? – Khoa TruongDinh Feb 17 '17 at 8:06
  • there are 2 country filed in checkout_index_index.xml <item name="filterBy" xsi:type="array"> <item name="target" xsi:type="string"><![CDATA[${ $.provider }:${ $.parentScope }.country_id]]></item> <item name="field" xsi:type="string">country_id</item> </item> and this one <item name="country_id" xsi:type="array"> </item> – Alin Lupoiu Feb 17 '17 at 8:12
  • in which one i need to add this line <item name="visible" xsi:type="boolean">false</item>? – Alin Lupoiu Feb 17 '17 at 8:13
0

I had same problem. Solved it with this code:

app/design/frontend/Vendor/theme/Magento_Checkout/layout/checkout_cart_index.xml

<referenceBlock name="checkout.cart.shipping">
            <arguments>
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="block-summary" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="block-shipping" xsi:type="array">
                                    <item name="children" xsi:type="array">
                                        <item name="address-fieldsets" xsi:type="array">
                                            <item name="children" xsi:type="array">
                                                <item name="country_id" xsi:type="array">
                                                    <item name="visible" xsi:type="boolean">false</item>
                                                </item>
                                                <item name="region_id" xsi:type="array">
                                                    <item name="visible" xsi:type="boolean">false</item>
                                                    <item name="config" xsi:type="array">
                                                        <item name="componentDisabled" xsi:type="boolean">true</item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
</referenceBlock>
0

It should disappear by following:

<item name="country_id" xsi:type="array">
    <item name="visible" xsi:type="boolean">false</item>
</item>
  • using this way region/state filed also get hidden. But state field required here and country fields should be hidden. – Manish Jun 27 '18 at 16:05
0

Use below code:

<item name="region_id" xsi:type="array">
   <item name="visible" xsi:type="boolean">false</item>
    <item name="config" xsi:type="array">
      <item name="componentDisbaled" xsi:type="boolean">true</item>
    </item>
</item>
  • Do let me know if you face any issue. – mighty_hk Jun 30 '18 at 9:39

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.