Hide Company Name Field in WooCommerce Checkout Easily

How to remove company name field in woocommerce; Woocommerce hide company name field; Remove company name from checkout woocommerce; Woocommerce checkout remove company field; Delete company name field woocommerce; Woocommerce checkout hide company name; Remove company name field wordpress; Woocommerce checkout page remove company name; How to hide company name in woocommerce checkout; Woocommerce remove company name input;

Explanation

If you're looking to tidy up your WooCommerce checkout page by removing the company name field, this snippet is just what you need.

What It Does:

  • It removes the company name field from both the billing and shipping sections of the checkout page.

How It Works:

  • The code uses a filter to modify the checkout fields.
  • It checks if the company name field exists in the billing and shipping sections.
  • If found, it removes these fields, simplifying the checkout process for your customers.

Simply add this code to your theme's functions.php file, and the company name field will no longer appear during checkout. This makes the checkout process cleaner and potentially faster for your customers. Happy selling!

Code

add_filter( 'woocommerce_checkout_fields', 'wp_dudecom_remove_company_name_field' );

/**
 * Remove the company name field from WooCommerce checkout.
 *
 * @param array $fields The checkout fields.
 * @return array Modified checkout fields.
 */
function wp_dudecom_remove_company_name_field( $fields ) {
    if ( isset( $fields['billing']['billing_company'] ) ) {
        unset( $fields['billing']['billing_company'] );
    }
    if ( isset( $fields['shipping']['shipping_company'] ) ) {
        unset( $fields['shipping']['shipping_company'] );
    }
    return $fields;
}

Instructions

File Location: functions.php

Prerequisites:

  • Ensure WooCommerce is installed and activated on your WordPress site.

Implementation Steps:

  1. Log in to your WordPress admin dashboard.
  2. Navigate to Appearance > Theme Editor.
  3. In the right-hand sidebar, locate and click on functions.php under the Theme Files section.
  4. Scroll to the bottom of the functions.php file.
  5. Copy and paste the provided code snippet at the end of the file:
  6. add_filter( 'woocommerce_checkout_fields', 'wp_dudecom_remove_company_name_field' );
    
    /**
     * Remove the company name field from WooCommerce checkout.
     *
     * @param array $fields The checkout fields.
     * @return array Modified checkout fields.
     */
    function wp_dudecom_remove_company_name_field( $fields ) {
        if ( isset( $fields['billing']['billing_company'] ) ) {
            unset( $fields['billing']['billing_company'] );
        }
        if ( isset( $fields['shipping']['shipping_company'] ) ) {
            unset( $fields['shipping']['shipping_company'] );
        }
        return $fields;
    }
  7. Click the Update File button to save your changes.
  8. Visit your WooCommerce checkout page to ensure the company name field is no longer visible.

If you need assistance with this implementation or require more advanced functionality, consider reaching out to wp-dude.com for expert help.