Removing company name from WooCommerce checkout

To remove the company name field from the WooCommerce checkout, all you need is use the hook woocommerce_checkout_fields and then apply a filter to unset the [billing] [billing_company] field from the array returned.

add_filter( ‘woocommerce_checkout_fields’ , ‘remove_company_name’ ); function remove_company_name( $fields ) { 
   unset($fields[‘billing’][‘billing_company’]); 
   return $fields;
}

Note: You can also unset other fields using the same method. Here is another example:

add_filter( ‘woocommerce_checkout_fields’ , ‘custom_remove_woo_checkout_fields’ );
 
function custom_remove_woo_checkout_fields( $fields ) {
// remove billing fields
 unset($fields[‘billing’][‘billing_first_name’]);
 unset($fields[‘billing’][‘billing_last_name’]);
 unset($fields[‘billing’][‘billing_company’]);
 unset($fields[‘billing’][‘billing_address_1’]);
 unset($fields[‘billing’][‘billing_address_2’]);
 unset($fields[‘billing’][‘billing_city’]);
 unset($fields[‘billing’][‘billing_postcode’]);
 unset($fields[‘billing’][‘billing_country’]);
 unset($fields[‘billing’][‘billing_state’]);
 unset($fields[‘billing’][‘billing_phone’]);
 unset($fields[‘billing’][‘billing_email’]);
 
 // remove shipping fields 
 unset($fields[‘shipping’][‘shipping_first_name’]); 
 unset($fields[‘shipping’][‘shipping_last_name’]); 
 unset($fields[‘shipping’][‘shipping_company’]);
 unset($fields[‘shipping’][‘shipping_address_1’]);
 unset($fields[‘shipping’][‘shipping_address_2’]);
 unset($fields[‘shipping’][‘shipping_city’]);
 unset($fields[‘shipping’][‘shipping_postcode’]);
 unset($fields[‘shipping’][‘shipping_country’]);
 unset($fields[‘shipping’][‘shipping_state’]);
 
 // remove order comment fields
 unset($fields[‘order’][‘order_comments’]);
 
 return $fields;
}

Leave a Reply

Your email address will not be published. Required fields are marked *