Conditional Fields 2.2.9 introduced the action hook wpcf7cf_step_completed. This hook is triggered each time a step is validated. The hook is not triggered on the last step, because at this point the entire form is validated.

Example: send email when first step is completed

Let’s say you have created a multistep form like this:


    Step 1

    Step 2

    Step 3

    See this example in action here: https://conditional-fields-cf7.bdwm.be/wpcf7cf_step_completed/


    Form Code

      <label> Your name [text* your-name] </label>
      <label> Your email [email* your-email] </label>
      <label> Subject [text* your-subject] </label>
      <label> Your message (optional) [textarea your-message] </label>
      See this example in action here: <a href="https://conditional-fields-cf7.bdwm.be/wpcf7cf_step_completed/">https://conditional-fields-cf7.bdwm.be/wpcf7cf_step_completed/</a>
    [submit "Submit"]

    Edit this form in the form tester

    You can then insert the form with this shortcode:

    [contact-form-7 id="98" title="My form"]

    Take note of the form ID. In this case it’s 98, but make sure to change it to your own ID if you copy the code below.

    Now open your theme’s functions.php file and add this code:

    add_action('wpcf7cf_step_completed', function($result) {
        $form_id = $_POST['_wpcf7'];
        if ($form_id !== '98') { // <--- enter your form ID here
        $posted_data = $_POST;
        $steps = json_decode( stripslashes( $posted_data['_wpcf7cf_steps'] ), true );
        if ($steps['currentStep'] !== 1) { // <--- only trigger after completing first step
        $message = "
            Hi admin,
            someone has completed step 1.
            Name: {$posted_data['your-name']}
            Email: {$posted_data['your-email']}
            Kind regards,
            your form
        wp_mail('admin@example.com', 'A user completed step 1', $message);
    }, 10, 1);