Integrate ConvertKit & WPForms: Only add user if checkbox is checked

Integrate ConvertKit and WPForms will add any user who fills out your form to your ConvertKit list. You can use the be_convertkit_process_form filter to limit this integration based on any criteria you choose.

In this example, our form (Form ID=20) has a checkbox (Field ID=5).

We only want to add the user to ConvertKit if “Subscribe to Daily Recipes Email” is checked.

This code should be added to your theme’s functions.php file or a core functionality plugin.

<?php
/**
* Limit ConvertKit signup based on checkbox
*
*/
function ea_wpforms_limit_convertkit_signup( $process, $fields, $form_data ) {
// Limit to user registration form
if( 20 != $form_data['id'] )
return $process;
// Don't process if checkbox is empty
if( empty( $fields[5]['value_raw'] ) )
$process = false;
return $process;
}
add_filter( 'be_convertkit_process_form', 'ea_wpforms_limit_convertkit_signup', 10, 3 );
view raw functions.php hosted with ❤ by GitHub

Integrate ConvertKit and WPForms