1. Documentation /
  2. WooCommerce Admin Custom Order Fields

WooCommerce Admin Custom Order Fields

The Admin Custom Order Fields extension allows you to add fields to an order for details, notes, dates, and more. These fields can also be used to sort or filter orders in the order dashboard, and are geared towards streamlining and centralizing order information and notes. By default, these fields can only be viewed by the administrator, but can optionally be included on the customer’s “My Order” page. To learn how to optionally include this information, check out the section on Field Attributes.

Installation

↑ Back to top

  1. Download the extension from your WooCommerce dashboard
  2. Go to Plugins > Add New > Upload and select the ZIP file you just downloaded
  3. Click Install Now, and then Activate
  4. Go to WooCommerce > Custom Order Fields and read the next section to learn how to use the plugin.

Setup and Configuration

↑ Back to top

Setup

↑ Back to top
There are no general settings to configure for Admin Custom Order Fields, but there are a few options you can set for each field you create. First, to create a field, go to WooCommerce > Custom Order Fields.
WooCommerce Admin Custom Order Fields add a field
Creating an Admin Order Field
Click “Add Field” and begin creating your order field. The “label” is the field name, and will be displayed in the order details. The “description” will be displayed to the user upon hovering over the “?” symbol. The first option to configure will be the type.
WooCommerce Admin Custom order Fields Type
Selecting Order Field Type

Field Types:

↑ Back to top
  • Text – Allows the admin to enter a short string of text for the field. For example, you could use this field to set a group name on a tour (can be used to sort alphabetically or to filter orders).
  • Text Area – Allows the admin to enter a long string of text for the field. Useful for notes or customer requests (can be used to sort alphabetically).
  • Radio – Creates a list with radio buttons in the order details to select one of multiple options (can be used to sort alphabetically or to filter orders).
WooCommerce Admin Custom Order Fields | Field Types
Order Field Types
  • Select – Creates a drop-down menu in the order details to select one of multiple options (can be used to sort alphabetically/numerically or to filter orders).
  • Checkbox – Creates a list with checkboxes in the order details to select one, several, or all of multiple options (can be used to filter orders).
  • Multiselect – Creates a field to select one, several, or all of multiple values in the order details (can be used to filter orders).
WooCommerce Admin Custom Order Fields Multiselect Order Field Type
Multiselect Order Field Type
  • Date – Uses a pop-up calendar to select a date (can be used to sort by date or to filter orders by month).
Sorting can be ascending or descending using alphabetic / numeric sorting.
WooCommerce Admin Custom Order Fields Order Dashboard
Viewing Fields and Sorting / Filtering
While creating a select, radio, multiselect, or checkbox type, you will be required to enter default/values. These are the options that will appear for a given field (each value will be an option for the user to select/check). Separate all values with a vertical pipe | (above Enter/Return on your keyboard). If you want to set a default value, enclose the value with a double asterisk, **, before and after the name.
WooCommerce Admin Custom Order fields Examples of Types, Values, and Attributes
Examples of Types, Values, and Attributes

Field Attributes:

↑ Back to top
You can also add attributes to an order field, which will affect when it is displayed and the potential to use it for sorting or filtering. Multiselect and checkboxes cannot be used for sorting.
  • Required – Adds a red asterisk to the field to denote that it should be completed. Is not required to save or complete the order, and is merely a visual cue.
  • Display in View Orders Screen – Adds the Order Field to the Orders Dashboard table and allows you to view the selected / entered information all in one screen.
  • Allow Sorting on View Orders Screen – Allows you to sort orders alphabetically or numerically based on the field for which this attribute is selected.
  • Allow Filtering on View Orders Screen – Allows you to filter orders (view only certain orders) based on the field for which this attribute is selected.
  • Show in My Orders/Email – Displays the Order Field to the customer on their “My Orders” page or in emails.
WooCommerce Admin Custom Order Fields Show in My Orders
Showing Order Fields to Customers in “My Orders”

Import and Export

↑ Back to top
Admin Custom Order Fields can be imported and exported from orders, as they’re stored as order metadata. While many importers and exporters can include order meta (post meta), here are some plugins that have dedicated compatibility added for Admin Custom Order Fields, with no action or custom code needed from the merchant.

Customer / Order CSV Export Compatibility

↑ Back to top
Admin Custom Order Fields is compatible with our Customer/Order CSV Export extension. Custom order fields can be added to your order CSV custom formats, or they’ll automatically be included in any built-in formats as new columns. In either case, the value for the custom field will be included for the order in each row, such as the text entered, the option selected, or a “Yes / No” for checkboxes. When using a custom format, you’ll be able to add your custom fields as new columns into the export file, then name your columns accordingly. You’ll need to know the ID of your custom field:
WooCommerce Admin Custom Order Fields field id
Field ID
Then you can add this field to the export by searching for admin_custom_order_field_{fieldID} and name its column in your format. WooCommerce Custom Order Fields: add field to custom CSV export When using a default or built-in format, custom order fields are added as columns in your CSV order export automatically. Exported order data from this plugin will now include a new column for each admin custom order field as part of the exported CSV.
Column Description Outputted Value Example
admin_custom_order_field The value selected for the admin custom order field String FirstName
The column name will append the field label and ID as well, so the column name will be displayed like so: admin_custom_order_field:serial_number_4 or admin_custom_order_field:pilot_assigned_21. The id of the admin custom order field is added to ensure that each column name is unique.

Customer / Order XML Export

↑ Back to top
Admin Custom Order Fields is compatible with the Customer / Order XML Export Suite extension. Exported order data is added in a dedicated XML tag automatically when using the “Default” or “Legacy” formats, while it can optionally be included in custom formats. To add the custom field information to a custom XML format, be sure to add the “AdminCustomOrderFields” data source to the format, then name the wrapper for the fields whatever you’d like. WooCommerce Custom Order Fields: add field to custom XML export When using a built-in format, <CustomFields> wrapper is added to the XML output; while using a custom format, the wrapper will use your custom name from the field mapper. This wrapper will contain a <CustomField> element for each field that’s part of the order. The field ID, admin name, and value (admin input) will be output for each field in the element. The value for the field may vary based on the field type, such as the text entered, the option selected, or a “Yes / No” for checkboxes. An example of expected XML output:
<CustomFields>
  <CustomField>
    <ID>field ID</ID>
    <Name>field admin name</Name>
    <Value>field's input for this order</Value>
  </CustomField>
</CustomFields>

CSV Import Compatibility

↑ Back to top
While Admin Custom Order Fields is not fully compatible with the Customer / Coupon / Order CSV Import Suite yet, most of its data can easily be imported. The meta keys for each admin custom order field are in the format of _wc_acof_{id} where {id} is replaced by the integer id of the field. This id is clearly visible next to the label of each field you have created, so to import this data you’d title your columns like so: meta:_wc_acof_{id}. All field values (except for Multiselect and Checkbox field types) can be easily imported. Multiselect and Checkbox fields can only be imported the same way if only one of the options is set. We’re working on a way to import multiple values for a field, but this isn’t currently possible until automatic support is added.

For Developers

↑ Back to top
You can access saved values for the custom orders fields for an order programmatically, as each admin custom order field is stored as order post meta. The meta keys for each admin custom order field are in the format of _wc_acof_{id} where {id} is replaced by the integer id of the field. This id is clearly visible next to the label of each field you have created:
WooCommerce Admin Custom Order Fields field id
Field ID
Once you know the id, you can use get_post_meta( $order_id, '_wc_acof_{id}', true ) to get the value of that custom field for a particular order. Need to populate field options from another data source? You could do so dynamically with the wc_admin_custom_order_field_options filter — see an example here.

Frequently Asked Questions

↑ Back to top
Q: Are custom fields searchable? A: Of course! When you add a custom field and update the order, that field value is now included in the order search and will return the order as a result.
Q: Are there any character limits for the “text” or “text area” types? A: No, these types have no character limits.
Q: Can the “text” or “text area” types accept HTML? A: Yes, these fields accept limited HTML like link tags. HTML can be used only in the value or content of the text box / textarea, HTML is not accepted in any field label.
Q: Can I export my custom field data? A: Yes! See our section above about using the CSV Order / Customer Exporter.
Q: If I show customers the order custom fields in the “My Account” section and emails, will this work with custom order statuses and custom emails? A: If you use the Order Status Manager plugin to trigger these emails, custom order fields will show within these emails still below the order table. For example, if you send a delivery details email when the order status is updated to “Out for Delivery”, the email will include your admin custom order fields. WooCommerce admin custom order fields in custom emails

Questions & Support

↑ Back to top
Have a question before you buy? Please fill out this pre-sales form. Already purchased and need some assistance? Get in touch with support via the help desk.