Why old WooCommerce checkout snippets fail on the Checkout block and how to add fields
Stores using the WooCommerce Checkout block, the default for new installs since version 8.3, do not run most classic checkout hooks, so older custom field snippets fail silently. The recommended approach is the Additional Checkout Fields API, stable since version 8.9, which is best placed in a small plugin so it persists across theme changes. The article's example registers a namespaced purchase order field with sanitization and validation callbacks. Developers must also watch for namespacing requirements, storage location options, and a hook name discrepancy between the documentation and the source code. Once registered, the field appears in admin, thank-you pages and emails, and the CheckoutFields helper can retrieve it in code.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in