Urgent.News

What's breaking now, across thousands of outlets.

Tech

Custom fields on the WooCommerce Checkout block: why your old snippet does nothing

If you added a checkout field with woocommerce_checkout_fields or printed one on woocommerce_after_order_notes , and it's simply not there on a newer store, the store is probably using the Checkout block. Since WooCommerce 8.3 (November 2023), new installs get the Cart and Checkout blocks by default. The Checkout block builds its form in React and talks to the Store API. Most classic checkout…

If you added a checkout field using woocommerce_checkout_fields or printed one using woocommerce_after_order_notes, you may have noticed it isn't appearing in newer WooCommerce stores. This is because the store likely utilizes the Checkout block, introduced in WooCommerce 8.3 (November 2023). This block creates its form in React and communicates with the Store API, causing most classic checkout hooks to not function.

While WooCommerce's compatibility table lists woocommerce_after_order_notes, woocommerce_before_order_notes, and woocommerce_review_order_before_submit as unsupported, woocommerce_checkout_fields is only partially supported. Another validation issue arises with woocommerce_checkout_process, which doesn't trigger, resulting in the field not being saved, nor any error displayed.

To address this, use the Additional Checkout Fields API, introduced in WooCommerce 8.9. Register the field by adding the following code to a plugin (not functions.php) to ensure it persists through theme changes. The ID must include a namespace (namespace/name); otherwise, registration fails with a _doing_it_wrong notice. The location setting determines where the field is stored—order for order-specific fields and contact or address for customer account or billing/shipping fields.

Choose the appropriate field type (text, select, checkbox, or date) from WooCommerce 11.2. Register the field using the woocommerce_init hook or later, as registering before after_setup_theme triggers a notice. When validating, ensure to do so after sanitize_callback, as validate_callback runs after sanitization. For cross-field validation, add a custom action and update the WP_Error object provided.

Do not return a new WP_Error object, as this does nothing. If other plugins added validations, check the specific error name they provided. In the admin order screen, thank-you page, and order emails, the field appears without additional code. In your custom code, fetch the field value using WooCommerce's helper class instead of raw meta keys.

Use the 'other' group for contact and order fields, and 'billing' or 'shipping' for address fields. Note that fields registered via this API do not appear on the shortcode checkout, so if you need to modify or remove core fields, use a type not listed (file upload, radio, textarea), or show an address field for only one address.

Remember, fields added with this API won't display on the shortcode checkout, so classic hooks are still necessary for such modifications.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Implementing 2026 Seller Compliance Practices for Retrying Failed Email API Calls

TL;DR: Retry a failed email API call only when the response is plausibly transient, use capped exponential backoff with jitter, and write an immutable attempt record before each sleep.

  • Implement capping mechanism for exponential backoff with jitter
  • Record attempt details for B2B marketplace orders
  • Distinguish between API acceptance and downstream delivery

Line-anchored output and the filter chips

JSLab feature notes: one docs page, explained. Today: The output panel . JSLab is a JavaScript & TypeScript scratchpad for macOS. You type, it runs, and the output panel fills up.

  • JSLab is a macOS development environment for JavaScript and TypeScript.
  • Output rows display line of code and corresponding results, logs, or errors.
  • Four filter chips categorize output entries and show live counts.

Java Virtual Threads vs Kotlin Coroutines: Suspension Models and the Shifting Bottleneck

The usage and internals of Java virtual threads and Kotlin coroutines are already widely covered. Rather than explaining each technology separately, this post compares how their different ways of…

  • Java virtual threads save stack for suspension, OS threads resume
  • Kotlin coroutines save local variables and label in Continuation object
  • Both shift resource bottleneck to less visible location

WireGuard on your own or Tailscale in a homelab: what control plane do you want to operate

In short: The short answer is that Tailscale is WireGuard with the coordination work done by someone else. The real question is not which one encrypts better, but which part of the control plane do…

  • Tailscale simplifies control with automatic network and NAT handling
  • WireGuard requires manual configuration and maintenance
  • Tailscale Personal plan is free for non-commercial use

More from Monday 2 November →