You need to add this code to your child theme’s file or via a plugin that allows custom functions to be added, such as the Code snippets plugin. Please don’t add custom code directly to your parent theme’s file as this will be wiped entirely when you update the theme.

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 if, for example, you want to include things like the ‘transaction key’ from PayPal orders.

Here is an example using a custom field that was added with the Checkout Field Editor extension. As of version 1.1.8 the code is no longer required for the extension’s own fields, but the code is still valid for custom fields created in other ways.

In this example, a custom field with the label hear_about_us was added:

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.