WooCommerce Changed, Interview Answers Didn’t: The Checkout Field on 4wp.dev

WooCommerce changed. The classic answer still adds the field. The Checkout block never shows it.

The case

The client’s accountant: “Why is there no VAT number in the orders for the last two weeks?”

The field was added with woocommerce_checkout_fields. Two weeks ago the checkout page was rebuilt on the Checkout block. The field just disappeared: no error, no warning in the log.

The hook didn’t break. Nobody calls it.

Why

Classic checkoutBlock checkout
FormPHP,
React block
Request?wc-ajax=checkoutStore API /wc/store/v1/checkout
Form hookswoocommerce_checkout_fields, woocommerce_checkout_processnot called
Order hookswoocommerce_order_status_*, woocommerce_payment_completework in both

The fix

PHP
<?php
add_action( 'woocommerce_init', static function () {
	if ( ! function_exists( 'woocommerce_register_additional_checkout_field' ) ) {
		return;
	}
	woocommerce_register_additional_checkout_field( [
		'id'       => 'forwp/vat-number',
		'label'    => __( 'VAT number', 'forwp' ),
		'location' => 'order',
		'type'     => 'text',
		'required' => false,
	] );
} );

The interview question

The client moved to block checkout and the VAT field disappeared. What do you do?

Weak answer. Add the field again through woocommerce_checkout_fields.

Strong answer. Block checkout doesn’t read woocommerce_checkout_fields, it works through the Store API. I register the field with the Additional Checkout Fields API with validation. I check where other parts read the field: emails, admin, export. The value is now stored under a different meta key, so I update those places. For old orders I keep reading the old key.

👉 The full chapter is in the course WooCommerce Development for Middle Devs: Module 4. Cart and Checkout

🔔 More WooCommerce videos: youtube.com/@4wpdev