13

How to remove Company field from checkout process in Magento 2? I've been looking for the template but have not found it.

Update: Is there any way to remove this field via layout or template?

  • I can't check at the moment as I'm on my phone, but I think it's related to a Knockout JS template. Is there anything in the form you can search for, such as a class or id? – Ben Crook May 4 '16 at 22:13
  • Shipping fields are inside: form id="co-shipping-form". Code for commpany field: <div class="field" name="shippingAddress.company" data-bind="visible: visible, attr: {'name': element.dataScope}, css: additionalClasses">" – Luis Garcia May 5 '16 at 17:19
17

Temporarily, we should try:

<item name="company" xsi:type="array">
    <item name="visible" xsi:type="boolean">false</item>
</item>

For example, in app/design/frontend/{Vendor Theme}/{Theme}/Magento_Checkout/layout/checkout_index_index.xml, find the component that you need to customize. Copy the corresponding node and all parent nodes up to . We're going to remove/disable telephone and company fields:

<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">
                                                        <!-- The name of the form the field belongs to -->
                                                        <item name="shipping-address-fieldset" xsi:type="array">
                                                            <item name="children" xsi:type="array">
                                                                <!--Remove fields-->
                                                                <item name="telephone" xsi:type="array">
                                                                    <item name="visible" xsi:type="boolean">false</item>
                                                                </item>
                                                                <item name="company" xsi:type="array">
                                                                    <item name="visible" xsi:type="boolean">false</item>
                                                                </item>
                                                            </item>
                                                        </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

[EDIT]:

From Magento 2.2.x

STORES > Configuration > Customersmers > Customer Configuration > Name and Address Options > Show Company > No

10

I have hide the company field in **Magento 2.1** using below steps:

Copy handle file in app/design/frontend/PackageName/ThemeName/Magento_Checkout/layout/checkout_index_index.xml

replace the below code:

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

with

<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>
  • It's enough use only <item name="visible" xsi:type="boolean">false</item> – LucScu Sep 19 '17 at 9:59
7

There is no need for coding,simply go to Stores > Configuration > Cutomers > Customer Configuration then in Name and Address Options You set Show Company to No

  • That actually removes the field. Correct. All the other answers in this thread only hide the field. – Daan van den Bergh Jun 12 '18 at 9:31
5

You should try to set false to visible attribute:

<item name="company" xsi:type="array">
    <item name="visible" xsi:type="boolean">false</item>
</item>
  • It doesn't work. – Luis Garcia May 17 '16 at 20:32
4

Magento Provide Backend Configuration for Company display or not in CHeckout. enter image description here

0

Go to vendor / magento / module-checkout / view / frontend / layout / checkout_index_index.xml

find:

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

Replace:

<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>
  • it's for Magento 2.1.9 – Atish Dipankar Baidya Apr 5 '18 at 9:19
  • you are recommending edit to the core which is not good, replace with proper way to set this value using best practices – Xenocide8998 Nov 1 '18 at 21:44

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.