I have used this after my form.But my entry does not go to the mailchimp account.Please tell me if anything missing.It is not working.How can I do it with API without using plugins?Because I want to customize fields in mailchimp

            <div id="tab1" class="tab-pane fade in active" style="border: 1px solid #77C04B;">
              <form class="customer_registration" method="post" >
                <div class="customer-bx clearfix row">
                  <div class="col-md-6">
                    <div class="form-group">
                      <input name="signup_first_name" type="text" class="form-control" placeholder="<?php esc_html_e('First Name', 'service-finder'); ?>">
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-group">
                      <input name="signup_last_name" type="text" class="form-control" placeholder="<?php esc_html_e('Last Name', 'service-finder'); ?>">
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-group">
                      <input name="signup_user_name" type="text" class="form-control" placeholder="<?php esc_html_e('Username', 'service-finder'); ?>">
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-group">
                      <input name="signup_user_email" type="text" class="form-control" placeholder="<?php esc_html_e('Email', 'service-finder'); ?>">
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-group">
                      <input name="signup_password" type="password" class="form-control" placeholder="<?php esc_html_e('Password', 'service-finder'); ?>">
                    </div>
                  </div>
                  <div class="col-md-6">
                    <div class="form-group">
                      <input name="signup_confirm_password" type="password" class="form-control" placeholder="<?php esc_html_e('Confirm Password', 'service-finder'); ?>">
                    </div>
                  </div>
                  <?php
                  $customertermchk = (isset($service_finder_options['terms-condition-checkbox-customers'])) ? esc_attr($service_finder_options['terms-condition-checkbox-customers']) : '';
                  if($customertermchk){
                  ?>
                  <div class="col-md-12">
                  <div class="form-group">
                    <div class="checkbox">
                    <input type="checkbox" value="yes" name="customertermsncondition" id="customertermsncondition">
                    <label for="customertermsncondition">
                    <?php
                    $customerterms = (isset($service_finder_options['text-terms-condition-checkbox-customers'])) ? $service_finder_options['text-terms-condition-checkbox-customers'] : ''; 
                    $allowedhtml = array(
                                'a' => array(
                                    'href' => array(),
                                    'class' => array(),
                                ),
                            );
                    echo wp_kses($customerterms,$allowedhtml); ?>
                    </label>
                  </div>
                  </div>
                  </div>
                  <?php } ?>
                  <?php echo service_finder_captcha('customersignup'); ?>
                    <div class="checkbox">
       <label>
           <input type="checkbox" id="emailUpdates" name="emailUpdates" value="Yes" style="opacity: 1;">    
          Please keep me informed of product updates and news
       </label>
    </div>

                    <?php

                            // SUBSCRIBE TO MAILING LIST OPTION - ADD TO MAILCHIMP USING API
                            if ($_POST['emailUpdates'] == 'Yes')
                            {
                                // Include Mailchimp API class
                                require_once('MCAPI.class.php');

                                // Your API Key: http://admin.mailchimp.com/account/api/
                                $api = new MCAPI('1f267d4c43cd8d20988305ba41b5966f-us15');

                                // Your List Unique ID: http://admin.mailchimp.com/lists/ (Click "settings")
                                $list_id = "ee3c45310c";

                                // Variables in your form that match up to variables on your subscriber
                                // list. You might have only a single 'name' field, no fields at all, or more
                                // fields that you want to sync up.
                                $merge_vars = array(
                                    'FNAME' => $_POST['signup_first_name'],
                                    'LNAME' => $_POST['signup_last_name']
                                );

                                // SUBSCRIBE TO LIST
                                if ( $api->listSubscribe($list_id, $_POST['signup_user_email'], $merge_vars) === true ){
                                    $mailchimp_result = 'Success! Check your email to confirm sign up.';
                                } else {
                                    $mailchimp_result = 'Error: ' . $api->errorMessage;
                                }
                            }

                            ?>

Read more here: I want to integrate mailchimp with wordpress without using plugins


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: