cwcfp_email_field_title

The cwcfp_email_field_title filter allows you to modify the Conditional Field's title that is sent to the customer.

The filter by default returns the Conditional Field's title. If you do nothing to the filter, this is what will be displayed.

The filter has two additional arguments passed to it, which can be helpful for determining what to display to the customer.

  • $value: An array that contains all of the settings for your Conditional Field.
  • $repeat: The number of times this field has been repeated. This can be useful if you want to display a different title after the first iteration of the field in the email, or even if you wish to include the number after the field title when displayed to the customer.

The $value array contains the following information:

  • id: The field's ID number.
  • field_title: The field's title.
  • hide_title: Whether or not the field's title should be hidden on the checkout page. 0 (false) or 1 (true).
  • before_field: Text shown before the field.
  • after_field: Text shown after the field.
  • save_input: Whether or not the customer's input should be saved to their account. 0 (false) or 1 (true).
  • sort_order: Numeric value indicating the position that the field should be displayed on the checkout page. Lower numbers are displayed first.
  • disable_input: Whether or not the input field should be disabled. 0 (false) or 1 (true).
  • required_field: Whether or not an input to the field should be mandatory. 0 (false) or 1 (true).
  • required_field_error: The error message shown if a required field is not completed.
  • repeat_field: Whether or not the field should repeat based on the quantity of the product in the customer's cart. 0 (false) or 1 (true).
  • minimum_quantity: The minimum quantity of a product that needs to be in the customer's cart before this field will be displayed.
  • append_title: Whether or not the quantity of the field should be appended to the field's title. 0 (false) or 1 (true).
  • products: An array of product IDs that need to be in the customer's cart before the field will be displayed.
  • prodcut_variations: A comma separated list of product price IDs and/or attribute slugs that need to be in the customer's cart before the field will be displayed.
  • categories: An array of category IDs that need to be in the customer's cart before the field will be displayed.
  • field_type: The input type for this field. Options are text, textarea, select, country, state, checkbox, password, radio, datepicker.
  • select_options: The options shown for select menus, or radio button input field types.
  • field_label: The text that shows up after the title and before the field.
  • placeholder: Placeholder text shown in the conditional field before a customer makes their entry.
  • class: The CSS class applied to the field.
  • add_order_email: Whether or not the customer's input should be added to the order confirmation email. 0 (false) or 1 (true).
  • add_order_invoice: Whether or not the customer's input should be added to the order invoice shown immediately after purchase. 0 (false) or 1 (true).
  • delete_field: Whether or not the field is deleted. 0 (false) or 1 (true). Note fields are never actually deleted from the database, since historic orders rely on the field title in order to display the order information correctly. Deleting the field simply removes it from the field listing, and prevents it from being displayed on the checkout page.

In your code, you can access the $value attributes like this:

$field_id = $value['id'];

For other attributes, simply replace id with the appropriate attribute.

To replace the field title with the field's label, you can use the following code:

add_filter( 'cwcfp_email_field_title', 'cwcfp_replace_field_title_field_label', 10, 3 );
function cwcfp_replace_field_title_field_label( $field_title, $value, $repeat ){
	return $value['field_label'];
}