How to disable showing custom fields in emails?

There are few filters that you can override to disable displaying of fields in emails:

  • wccf_email_display_user_field_values - User Fields
  • wccf_email_display_checkout_field_values - Checkout Fields
  • wccf_email_display_order_field_values - Order Fields

All of those filters has "true" as default value, so you just need to send "false" instead, for example like this:

add_filter('wccf_email_display_user_field_values', '__return_false');

It is also possible to do that conditionally, as there are also values of fields and order id available - as parameters, so you can check something and then disable (or not) the display of those fields.

add_filter('wccf_email_display_user_field_values', 'maybe_disable_wccf_email_display_user_field_values');

function maybe_disable_wccf_email_display_user_field_values($bool, $fields, $order_id) {

    // Check value
    foreach ($fields as $field) {

        if ($field['display_value'] == 'Some Value') {
            return false;
        }
    }
    
    return $bool;
}
Have more questions? Submit a request