Hide Order Custom Fields from confirmation email

Is there a way to hide a order custom field from the confirmation email?

In this particular case, I have added a hidden field on the checkout flow which value has been set trough Javascript. Thus the customer does not need to see this data in the order confirmation mail.

In this case; the custom field is “ophaal-momentDEV”

Thank you!


You may edit your email templates. In this particular case, the hidden custom fields should already be hidden by default. In the lines 192-213 of the default invoice email templates, it checks the type of each order custom field and does not show hidden types :

                {{ #has_any order.customFields }}
                    <table width="100%" cellpadding="5" cellspacing="0">
                                <h3 size="12">Your order</h3>

                                    {{ #each order.customFields }}
                                    {{ #if_not_eq type 'hidden' }}
                                    <li style="list-style-type: square">
                                        <span size="9">
                                            {{ cleanHtml name }}: {{ cleanHtml value }}
                                    {{ /if_not_eq}}
                                    {{ /each }}
                    {{ /has_any }}

Have you set the field to the hidden type or hid it otherwise?