Pregunta

I am working on checkout step for hiding the company field on the basis of customer group. can anyone help me to solve this ? Thanks

¿Fue útil?

Solución

Create this in frontend theme->

app/design/frontend/VENDOR/NAME/Magento_Checkout/layout/checkout_index_index.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<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="mobile.top.search" remove="true"/>
        <referenceContainer name="checkout.header.wrapper">
      <container name="checkout.header.wrapper.container" htmlTag="div" htmlClass="header-wrapper-container" />
        </referenceContainer>
        <move element="logo" destination="checkout.header.wrapper.container"/>
        <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">
                                                                <item name="company" xsi:type="array">
                                                                    <item name="visible" xsi:type="boolean">true</item>
                                                                </item>
                                                          </item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

hoping this should solve the issue for you

Otros consejos

Another answer for this will be

Stores > Configuration > Cutomers > Customer Configuration

Name and Address Options -> Show Company -> No
Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top