# Make the Company Name Required

> Turns the optional Company field into a required one for stores that sell only to businesses.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, checkout, b2b, fields
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-require-company-name/

## Code

```php
add_filter( 'woocommerce_billing_fields', function ( $fields ) {
    if ( isset( $fields['billing_company'] ) ) {
        $fields['billing_company']['required'] = true;
    }

    return $fields;
}, 20 );
```

## Notes

Make sure the Company field is not hidden in Appearance > Customize > WooCommerce > Checkout.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Make the Company Name Required" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
