# Purchase Order Number on the Block Checkout

> Adds an optional "Purchase order number" field to the Checkout block for business buyers, saved on the order with WooCommerce's additional fields API.

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

## Code

```php
add_action( 'woocommerce_init', function () {
    if ( ! function_exists( 'woocommerce_register_additional_checkout_field' ) ) {
        return;
    }

    woocommerce_register_additional_checkout_field( array(
        'id'         => 'wpide/po-number',
        'label'      => 'Purchase order number (optional)',
        'location'   => 'order',
        'type'       => 'text',
        'required'   => false,
        'attributes' => array(
            'maxLength'    => 40,
            'autocomplete' => 'off',
        ),
    ) );
} );
```

## Notes

Needs WooCommerce 8.9 or newer, and the value appears on the order screen, in emails and on the confirmation page automatically.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Purchase Order Number on the Block Checkout" 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/
