WooCommerce has more than 5 million active installations in the WordPress community, and this number continues to rise because WooCommerce is flexible for customization. In this post, you will see how you can hide the Company Name field from the WooCommerce Checkout page.
WooCommerce Hide Company Name Field Checkout Page
There are many reasons why you may want to hide the Company Name field from the WooCommerce Checkout.
One of the situations that may force you to hide this field is selling to consumers rather than businesses. If you own a consumer-focused WooCommerce store, having the company name field is just added friction on your Checkout. This could potentially confuse customers if they are not sure whether it needs to be filled out or not.
From an expert’s perspective, you need to optimize your Checkout page. You can do this by removing unnecessary fields on this page. This means that users will not take a long time to finalize an order.
Steps to Hide the Company Name Field from the Checkout Page
However, it is very easy to hide the Company Name field from the WooCommerce Checkout. In this section, we will use a custom PHP script that I have created. Moreover, I will illustrate how you can implement this solution on your WooCommerce store, using the Storefront theme.
Here is how the Company Name field is displayed on the checkout page:
Here are the steps that you need to follow:
- Log into your WordPress site and access the Dashboard as the admin user.
- From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file to rename the address tab on the My Accounts page.
- Click anywhere on the text editor and scroll to the bottom of the functions.php file. Paste the code at the end:
/** * @ snippet Hide the Company Name Field from the Checkout Page */ add_filter( 'woocommerce_checkout_fields' , 'remove_company_name' ); function remove_company_name( $fields ) { unset($fields['billing']['billing_company']); return $fields; }
- Click on the Save changes button at the bottom of the text editor screen.
- You have successfully added the code snippet required to hide the Company Name field on the Checkout page. This will be the outcome on the front end:
How the Code Works
WooCommerce makes it easy to customize the Checkout by using hooks and filters. To hide the Company name field, I used the woocommerce_checkout_fields
hook and then applied a filter to unset the [billing] [billing_company]
field from the array returned.
Conclusion
In summary, this post shares how you can hide the Company Name field on the WooCommerce Checkout page. However, I highly recommend using a child theme to follow the steps that I have shared. If you do not have a child theme, please create one.
Before making changes to your PHP file, take a backup. You can either copy and paste the contents into an empty notepad document or download a copy from cPanel File Manager if you know how to do this. If you are not familiar with handling code, I recommend that you hire a qualified WordPress developer.
Similar Articles
- How to Add WooCommerce Payment Icons In the Footer [HTML]
- How to Set up WooCommerce Storefront Footer Widgets
- How to Count Items Added to Cart WooCommerce Cart Count Code
- How to Hide Tax On Checkout If Field Value Exists WooCommerce
- How to Hide WooCommerce Product from Search Results
- How to Hide Cart Subtotal In WooCommerce or Remove Subtotal Row
- How to Put WooCommerce Cart and Checkout on One Page
- How to Add a Trust or Secure Logo on WooCommerce Checkout Page
- How to Change Proceed To Checkout Text In WooCommerce
- How to Simplify Checkout Free Items Storefront Theme
- WooCommerce Logout PHP Snippet to Create Logout Button
- How to Get Payment Methods in WooCommerce » Code Example
- How to Use WooCommerce Product Attributes Step by Step [Complete Guide]
- How to Change Size of Cart Icon In WooCommerce Storefront Theme
- How to Remove Cart Page WooCommerce Storefront Theme
- How to Hide Errors From Visitors WooCommerce
- How to Get Current Product Category Name in WooCommerce