Custom checkout fields
The Custom Checkout Fields module in Polski for WooCommerce adds your own fields to the WooCommerce checkout: text, textarea, select, checkbox, radio, number, email, date and phone. Each value is saved on the order and can be shown in the admin order screen, order emails and My Account. The module is off by default and covers both the classic and the block checkout.
Enabling
Section titled "Enabling"Go to Polski > Modules and enable the Custom Checkout Fields module in the "Checkout" section.
Managing fields
Section titled "Managing fields"Once the module is enabled, go to WooCommerce > Checkout Fields to add and edit fields. The screen needs the manage_woocommerce capability. Every save replaces the whole list, stored in the polski_custom_checkout_fields option. A row with an empty name is dropped on save.
Available field types
Section titled "Available field types"| Type | Description |
|---|---|
| Text | Text field |
| Textarea | Multi-line text field |
| Select | Drop-down list |
| Checkbox | Checkbox |
| Radio | Radio buttons |
| Number | Numeric field |
| Email field with format validation | |
| Date | Date field |
| Phone | Phone field |
Field configuration
Section titled "Field configuration"| Option | Description | Default |
|---|---|---|
| Enabled | Whether the field is active | Off |
| Name (meta key) | The key the value is saved under, cleaned with sanitize_key() (lowercase letters, digits, - and _) |
none |
| Label | The label text shown above the field | none |
| Type | Field type (from the list above) | Text |
| Section | Billing, Shipping, or Order notes | Billing |
| Required | Whether the field is mandatory | Off |
| Priority | Display order (lower = earlier), clamped to 1 to 999 | 100 |
| Placeholder | Hint text inside the field | none |
| Options | For select/radio: one option per line (value|label) | none |
| CSS class | CSS classes (e.g. form-row-wide, form-row-first) | form-row-wide |
| Show in emails | The field value in order emails | On for a new row |
| Show in admin | The field value in the order panel | On for a new row |
| Show in My Account | The field value on the customer's order page | On for a new row |
Options for Select/Radio
Section titled "Options for Select/Radio"Enter the options one per line in the format:
value|LabelExample:
company|Companyindividual|Private individualA line without a | uses the same text as value and label. In the admin order screen, emails and My Account the module shows the label of the chosen option, not its stored value.
Classic checkout and block checkout
Section titled "Classic checkout and block checkout"The module registers its fields on both checkouts at once.
| Classic checkout (shortcode) | Block checkout | |
|---|---|---|
| Where the field appears | In the chosen section (billing, shipping or order notes), at its priority | Under "Additional order information", whatever section you chose |
| Field types | All nine types render natively | Select and radio become a drop-down, checkbox stays a checkbox, every other type is a plain text box |
| Select or radio without options | Rendered | Left out |
| Display conditions | Applied | Not applied |
| Validation | WooCommerce checks required fields, the module checks email format | Required check, plus format checks for email, number and date (YYYY-MM-DD) |
The block checkout uses WooCommerce's additional checkout fields API (woocommerce_register_additional_checkout_field) with field IDs polski/<name>. The module copies each block value to the same _<name> order meta the classic checkout writes, so both checkouts feed the same admin, email and My Account display.
Displaying values
Section titled "Displaying values"Each value is displayed only when its display switch is on and the value is not empty:
- In the order admin panel: billing and order-notes fields below the billing address, shipping fields below the shipping address
- In order emails, after the order table (HTML and plain text emails)
- On the "My account > Order details" page, under an "Additional information" heading
Validation and saving
Section titled "Validation and saving"- Required fields: validated when the order is placed
- Email fields: address format validation on both checkouts
- Number and date fields: format checked on the block checkout only; a date must be YYYY-MM-DD
- The value is saved in the order meta under
_<name>. Textarea values keep their line breaks; other types are saved as single-line sanitized text
Display conditions (classic checkout)
Section titled "Display conditions (classic checkout)"Each saved field can carry conditions. There is no screen for them, so set them in the polski_custom_checkout_fields option, for example with WP-CLI or a snippet. A field whose condition does not match is left out of the classic checkout.
| Key | The field shows when |
|---|---|
conditional_shipping |
The chosen shipping method ID starts with this text (e.g. flat_rate) |
conditional_payment |
The chosen payment method ID equals this value (e.g. bacs) |
conditional_field + conditional_value |
The other checkout field holds exactly this value |
conditional_category |
The cart contains a product from this category ID |
conditional_cart_min |
The cart subtotal is at least this amount |
The shipping and payment conditions pass while the customer has not chosen a method yet.
Where is the value of a custom checkout field stored?
Section titled "Where is the value of a custom checkout field stored?"In the order meta, under the field name with a leading underscore: a field named delivery_note is saved as _delivery_note. Read it with $order->get_meta( '_delivery_note' ).
Why does my date field show as a text box on the block checkout?
Section titled "Why does my date field show as a text box on the block checkout?"The block checkout's additional fields API offers only text, select and checkbox types. The module maps number, email, date and phone to text and checks the format on submit, so a date has to be typed as YYYY-MM-DD.
Can I show a field only for one payment or shipping method?
Section titled "Can I show a field only for one payment or shipping method?"Yes, on the classic checkout. Set conditional_payment or conditional_shipping on the field in the polski_custom_checkout_fields option. The block checkout ignores conditions and always shows the field.