Hi @ricks03,
I apologize as customizations like this is outside of our scope for support. In case it helps, you can check out our developers’ documentation as a reference.
Thanks!
I didn’t expect it to be a customization, I expected it to be a flag or default value or something?
Or WPForms support could provide me the answer – which they did.
“I have checked this with the development team and they have sent me a code snippet to achieve what you have requested:
add_filter( 'wpforms_entry_save_data', static
function ( $fields, $entry, $form_data ) {
$value1 = '';
$value2 = '';
// These are field IDs to take data from, and to merge into.
$field1_id = 1;
$field2_id = 2;
$merged_id = 3;
foreach ( $fields as $field ) {
if ( $field['id'] === $field1_id ) {
$value1 = $field['value'];
}
if ( $field['id'] === $field2_id ) {
$value2 = $field['value'];
}
}
$fields[ $merged_id ]['value'] = $value1 . ' - ' . $value2;
return $fields;
}, 10, 3 );
Simply create 2 Single Line Text fields and a Hidden field,
which will store the merged text fields when the form is submitted.
Please doublecheck if you have used the correct IDs for the Text and
hidden fields. $merged_id is where data will be saved (hidden field).
In case it helps, here’s our tutorial with the most common ways to add
custom code like this:
https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/.
For the most beginner-friendly option in that tutorial, I’d recommend
using the Code Snippets plugin:
http://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/.
This will protect your code from updates and keep it easy to manage
right within your WordPress admin area.I hope this helps!