Customize your WooCommerce checkout without a plugin? It's possible — if you're comfortable with a few lines of PHP. In this post, you'll find 20 ready-to-use code snippets using the woocommerce_checkout_fields
filter. They cover real-life cases like removing fields, renaming labels, or adding new options.
If you're not into coding, don’t worry — we’ll also show you how to use the Flexible Checkout Fields plugin to achieve the same result visually.
What is checkout customization and how it helps improve conversions?
Your checkout is where visitors become customers. But if it’s cluttered with unnecessary fields or lacks flexibility, it can cause friction. Customizing the checkout helps reduce abandonment, speed up purchases, and create a better experience.
WooCommerce comes with a flexible filter: woocommerce_checkout_fields
. You can use it to modify billing, shipping, or additional fields. It’s perfect for developers who want control over field visibility, order, and content.
20 code examples using woocommerce_checkout_fields filter
Below are 20 examples. Add these snippets to your child theme’s functions.php
or a custom plugin.
1. Remove the second address field
// This code allows disabling the second address field.
add_filter('woocommerce_checkout_fields','hide_address_2_field_classic_checkout');
function hide_address_2_field_classic_checkout($fields) {
unset ($fields['billing']['billing_address_2']);
return $fields;
}
2. Hiding the phone field
// This code allows hiding the phone field
add_filter('woocommerce_checkout_fields', 'hide_billing_phone_field_classic_checkout');
function hide_billing_phone_field_classic_checkout($fields) {
unset ($fields['billing']['billing_phone']);
return $fields;
}
3. Make the email field optional
// This code makes the email field optional
add_filter('woocommerce_checkout_fields', 'optional_billing_email_field_classic_checkout');
function optional_billing_email_field_classic_checkout($fields) {
$fields['billing']['billing_email']['required'] = false;
return $fields;
}
4. Change placeholders for the first and last name fields
// This code allows adding the placeholder of the name and last name fields
add_filter('woocommerce_checkout_fields', 'add_name_placeholders_classic_checkout');
function add_name_placeholders_classic_checkout($fields) {
$fields['billing']['billing_first_name']['placeholder'] = 'Enter your name';
$fields['billing']['billing_last_name']['placeholder'] = 'Enter your surname';
return $fields;
}
5. Rename “Last name” to “Surname”
// This code allows changing the last name field's label
add_filter('woocommerce_checkout_fields', 'change_last_name_label_classic_checkout');
function change_last_name_label_classic_checkout($fields) {
$fields['billing']['billing_last_name']['label'] = 'Surname';
return $fields;
});
6. Add a custom text field
// This code allows adding a new text field after the email field
add_filter('woocommerce_checkout_fields', 'add_custom_text_field_classic_checkout');
function add_custom_text_field_classic_checkout($fields) {
$fields['billing']['billing_extra_field'] = [
'label' => 'Custom text field',
'type' => 'text',
'required' => false,
'priority' => 120,
];
return $fields;
}
7. Add a textarea for delivery instructions
// This code allows adding a textarea field after the email field and the custom field from the previous example - with further priority
add_filter('woocommerce_checkout_fields', 'add_custom_textarea_field_classic_checkout');
function add_custom_textarea_field_classic_checkout($fields) {
$fields['billing']['delivery_instructions'] = [
'label' => 'Delivery instructions',
'type' => 'textarea',
'required' => false,
'priority' => 130,
];
return $fields;
}
8. Set custom CSS class
// This code allows adding custom CSS classes to the first and last name fields
add_filter('woocommerce_checkout_fields', 'add_custom_css_classes_classic_checkout');
function add_custom_css_classes_classic_checkout($fields) {
$fields['billing']['billing_first_name']['class'] = ['form-row-wide primary'];
$fields['billing']['billing_last_name']['class'] = ['form-row-wide secondary effect'];
return $fields;
}
9. Change email field priority
/* This code allows moving email after the last name field. The default priority for billing fields:
billing_first_name (10)
billing_last_name (20)
billing_company (30)
billing_country (40)
billing_address_1 (50)
billing_address_2 (60)
billing_city (70)
billing_state (80)
billing_postcode (90)
billing_phone (100)
billing_email (110)
*/
add_filter('woocommerce_checkout_fields', 'place_email_after_last_name_classic_checkout');
function place_email_after_last_name_classic_checkout($fields) {
$fields['billing']['billing_email']['priority'] = 25;
return $fields;
}
10. Remove postcode field
// This code allows disabling the postcode field.
add_filter('woocommerce_checkout_fields','disable_postcode_field_classic_checkout');
function disable_postcode_field_classic_checkout($fields) {
unset ($fields['billing']['billing_postcode']);
return $fields;
}
11. Reorder first name after last name
// This code allows moving the first name field after the last name field
add_filter('woocommerce_checkout_fields', 'place_first_name_after_last_name_classic_checkout');
function place_first_name_after_last_name_classic_checkout($fields) {
$fields['billing']['billing_first_name'] = array(
'priority' => 22,
'class' => 'form-row-last',
'label' => 'First name',
);
$fields['billing']['billing_last_name']['class'] = 'form-row-first';
return $fields;
}
12. Add a checkbox for invoice request
// This code allows adding a custom checkbox for invoice request.
add_filter('woocommerce_checkout_fields', 'add_custom_checkbox_field_classic_checkout');
function add_custom_checkbox_field_classic_checkout($fields) {
$fields['billing']['request_invoice'] = [
'label' => 'Request invoice',
'type' => 'checkbox',
'required' => false,
'priority' => 140,
];
return $fields;
}
13. Add select dropdown for delivery time
// This code allows adding a custom select field
add_filter('woocommerce_checkout_fields', 'add_custom_select_classic_checkout');
function add_custom_select_classic_checkout($fields) {
$fields['billing']['delivery_time'] = [
'label' => 'Delivery time',
'type' => 'select',
'options' => [
'' => 'Select...',
'morning' => 'Morning',
'evening' => 'Evening',
],
'priority' => 150,
];
return $fields;
}
14. Pre-fill order comments
// This code allows adding a default field value for order notes
add_filter('woocommerce_checkout_fields', 'add_default_value_extra_notes_classic_checkout');
function add_default_value_extra_notes_classic_checkout($fields) {
$fields['order']['order_comments']['default']= 'No comments';
return $fields;
}
15. Add a custom number field
// This code allows adding a custom number field
add_filter('woocommerce_checkout_fields', 'add_custom_number_field_classic_checkout');
function add_custom_number_field_classic_checkout($fields) {
$fields['billing']['number_field'] = [
'label' => 'Number field',
'type' => 'number',
'validate' => 'number',
'required' => false,
'priority' => 200,
];
return $fields;
}
16. Add a date picker
// This code adds a custom date picker
add_filter('woocommerce_checkout_fields', 'add_custom_datepicker_classic_checkout');
function add_custom_datepicker_classic_checkout($fields) {
$fields['billing']['pickup_date'] = [
'label' => 'Pickup date',
'type' => 'date',
'validate' => 'date',
'required' => false,
'priority' => 170,
];
return $fields;
}
17. Disable phone validation
// This code removes the phone field validation
add_filter('woocommerce_checkout_fields', 'remove_phone_field_validation_classic_checkout');
function remove_phone_field_validation_classic_checkout($fields) {
$fields['billing']['billing_phone']['validate'] = false;
return $fields;
}
18. Make shipping country field appear last
/* This code allows moving shipping country after the last field. The default priority for shipping fields:
shipping_first_name (10)
shipping_last_name (20)
shipping_company (30)
shipping_country (40)
shipping_address_1 (50)
shipping_address_2 (60)
shipping_city (70)
shipping_state (80)
shipping_postcode (90)
*/
add_filter('woocommerce_checkout_fields', 'place_country_after_last_field_classic_checkout');
function place_country_after_last_field_classic_checkout($fields) {
$fields['shipping']['shipping_country']['priority'] = 999;
return $fields;
}
19. Remove shipping postcode field
// This code allows disabling the shipping postcode field.
add_filter('woocommerce_checkout_fields','disable_shipping_postcode_field_classic_checkout');
function disable_shipping_postcode_field_classic_checkout($fields) {
unset ($fields['shipping']['shipping_postcode']);
return $fields;
}
20. Add a custom field after order details
// This code allows adding a new text field after the order notes
add_filter('woocommerce_checkout_fields', 'add_custom_text_field_after_order_notes_classic_checkout');
function add_custom_text_field_after_order_notes_classic_checkout($fields) {
$fields['order']['order_extra_field'] = [
'label' => 'Text field',
'type' => 'text',
'required' => false,
'priority' => 20,
];
return $fields;
}
How to customize checkout without coding using Flexible Checkout Fields
Not a developer? No problem. The Flexible Checkout Fields plugin lets you do all the above — visually, from your WordPress dashboard.
- Add, remove, and rearrange fields using drag-and-drop
Reorder checkout fields in WooCommerce - Edit labels, placeholders, and default values
- Set fields as required, optional, or hidden
Hide WooCommerce checkout fields - Apply CSS classes or validation rules
Field validation in Flexible Checkout Fields for WooCommerce - Choose section: billing, shipping, or additional info
- Assign default values for testing or UX purposes
- All without editing PHP or writing custom code
Results without development overhead.
Flexible Checkout Fields PRO – advanced features
Want more power and flexibility? The PRO version adds advanced capabilities:
- Conditional logic for showing/hiding fields based on cart contents or user data
- Support for additional field types: date picker, time picker, radio with colors or images, and more
- Visibility control for user roles — display different fields to B2B and B2C users
- Field display based on selected shipping or payment method
- Additional price per field settings
You may see the plugin features on its product page.
Flexible Checkout Fields PRO WooCommerce £59
Edit, add new or hide unnecessary fields from the WooCommerce checkout form. Add pricing to fields and use conditional logic. It's all about conversions and better user experience. NEW: now you can set multiple conditions (OR) under one or more condition groups (AND).
💾 Active Installations: 90,000+ | WordPress Rating:
Summary: which method is best for your checkout?
Using woocommerce_checkout_fields
is a powerful way to customize WooCommerce checkout — but it requires careful coding and testing. Also, one needs to take care of the code and theme updates.
If you’re confident editing your theme, the 20 examples above should help you handle most common scenarios.
But for everyone else, the Flexible Checkout Fields for WooCommerce plugin offers a no-code, user-friendly alternative with even more options in the PRO version.
Key points
- The
woocommerce_checkout_fields
filter lets you customize the checkout form with PHP - You can use it to add, remove, rename, reorder, or style fields
- Flexible Checkout Fields plugin does the same — but without the need to code
- PRO version adds conditional logic, extra field types, and field pricing rules
- Choose the method that fits your workflow: code for control, plugin for speed