Magento 2 Remove Company Field From Checkout: Solved In 2 Ways

No comments

If your checkout process is too long or complicated, about 21% of online shoppers may drop their cart and leave. This is such an alarming figure, so it’s best to keep it as straightforward as can be for them. Different from Magento 1, Magento 2 has a much simpler checkout process. Yet, some fields are still considered irrelevant and may increase the time a person has to spend completing their payment. And a longer checkout may lead to a higher chance of cart abandonment, so no business would want that. You can remove the company field from checkout quickly, and there are 2 ways to do this.

Remove Company Field From Magento Backend

Removing the company field from Magento 2 backend is the easiest way to do this.

remove company field at checkout magento 2

Step 1: Access your Admin account, then navigate to Stores.

Step 2: Choose Configuration > Customer > Customer Configuration.

Step 3: Find and expand Name and Address Options.

Step 4: Scroll down to the Show Company field, choose ‘No’ to disable it.

Step 5: Click Save Config.

Head to your company’s checkout page, the Company field should be removed by now.

Remove Company Field Using Plugin

Another way to remove the filed is using a plugin.

Step 1: Create di.xml file at app/code/Tigren/Helloworld/etc/frontend/di.xml

Step 2: Paste the below code

<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Block\Checkout\LayoutProcessor">
        <plugin name="remove_company_from_checkout"
            type="Tigren\Helloworld\Plugin\Block\Checkout\LayoutProcessor"
            sortOrder="1"/>
    </type>
</config>

Step 3: Create LayoutProcessor.php file at app/code/Tigren/Helloworld/Plugin/Block/Checkout/

Step 4: Use this code

<?php
namespace Tigren\Helloworld\Plugin;
class LayoutProcessor
{
    public function afterProcess(
        \Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
        array $jsLayout
    ) {
        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
        ['shippingAddress']['children']['shipping-address-fieldset']['children']['company']['visible'] = 0;

        return $jsLayout;
    }
}

Step 5: Clear Cache and check your Checkout page again.

Wrap Up

You can follow either method to remove the Company field from Checkout for your Magento store. Don’t forget that the more straightforward your checkout process is, the better you can convince customers to finish their payments, so clear out any unimportant step in their way.

Hopefully, you found this guide useful. For more tutorials in the future, remember to subscribe to our blog!

Heiley NguyenMagento 2 Remove Company Field From Checkout: Solved In 2 Ways

Related Posts

Leave a Reply