WooCommerce Docs

Documentation, Reference Materials, and Tutorials for your WooCommerce products


Add a custom field (in an order) to the emails

Note: We are unable to provide support for customizations under our Support Policy. If you are unfamiliar with code and resolving potential conflicts, contact a WooExpert.

You can add any custom field to your order emails by hooking in and specifying the name of the custom field. This can be useful when used in conjunction with the Checkout Field Editor extension, or if you want to include things like the ‘transaction key’ from PayPal orders, for example.

Copy the following code to your theme functions.php then go to WooCommerce > Checkout Fields to add your newly created custom field.

Here is an example using the Checkout Field Editor extension of the WooCommerce > Checkout Field settings for a custom field created labeled ‘hear_about_us’:


Using this example the code would be:

$fields['How did you hear about us?'] = 'hear_about_us';
Back to the top