If you’re using a plugin that captures extra data in your WooCommerce Order, chances are you’d like to use this in another area of your site too, for example to display it in our WooCommerce PDF Invoices & Packing Slips plugin. It’s not always obvious where these custom fields are saved, under which field name or ‘meta key’ as it is called. Here’s how to find the field name of a custom field. There are two types, we’ll start with the easiest:
Normal custom fields #
If a custom field is added manually or not hidden by the plugin you used, you can see this in the order backend. Go to the order details page and scroll down, you’ll find the Custom Fields section:
This one’s easy, you can simply use/copy the full name listed under ‘Name’.
You can even add other custom fields here!
Hidden custom fields #
WooCommerce Orders contain a lot more custom fields than are listed here: addresses, payment gateway, dates, etc are all stored as custom fields. They are different from the regular custom fields because their name / meta key has been prefixed with an underscore. The billing email address for example is saved as ‘_billing_email’. To find these, you can use the WooCommerce Store Toolkit plugin. After installing & activating this plugin, you will get another section below the custom fields section in the order, showing all the data that is present in the order. The section you need is ‘Order Post Meta’:
As you probably guessed, the custom field name / meta key is printed in bold on the left.
That’s it! Now you know where to find all custom fields used for a WooCommerce order and what meta key is used for each field.