Adding Custom Registration Fields — a practical guide to WooCommerce registration fields with clear examples you can reuse in real projects.
WooCommerce Plugin Development Series (20/101). Prefer one article? Read the complete WooCommerce plugin development tutorial.
Short description
Add fields to the registration form, validate them, and save to user meta.
Registration field save
add_action('woocommerce_created_customer', function ($customer_id) {
if (isset($_POST['acme_company'])) {
update_user_meta(
$customer_id,
'acme_company',
sanitize_text_field(wp_unslash($_POST['acme_company']))
);
}
});