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.

/**
 * Limit ConvertKit signup based on checkbox
 * @link https://www.billerickson.net/code/integrate-convertkit-wpforms-conditional-processing/
 */
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 );

Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk