Thanks. This is what I have now including the new code you provided and the code I took and edited from the above link your provided:
function pw_edd_add_email_confirmation() {
?>
<p>
<label class=”edd-label” for=”edd-email-confirm”><?php _e(‘Confirm Your Email Address’, ‘edd’); ?></label>
<input class=”edd-input required” type=”email” name=”edd_email_confirm” placeholder=”<?php _e(‘Confirm email address’, ‘edd’); ?>” id=”edd-emai-confirml” value=””/>
</p>
<?php
}
add_action(‘edd_purchase_form_after_email’, ‘pw_edd_add_email_confirmation’);
function pw_edd_process_email_confirmation($valid_data, $data) {
if( !isset($data[‘edd_email_confirm’] ) || !is_email( $data[‘edd_email_confirm’] ) ) {
edd_set_error( ’email_confirmation_required’, __( ‘Please confirm your email’, ‘edd’ ) );
}
if( trim( $data[‘edd_email_confirm’] ) != trim( $data[‘edd_email’] ) ) {
edd_set_error( ’email_confirmation_required’, __( ‘Your email addresses do not match’, ‘edd’ ) );
}
}
add_action(‘edd_checkout_error_checks’, ‘pw_edd_process_email_confirmation’, 10, 2);
function pw_edd_purchase_form_required_fields( $required_fields ) {
$required_fields[‘edd_email_confirm’] = array(
‘error_id’ => ’email_confirmation_required’,
‘error_message’ => __( ‘Please confirm your email address.’, ‘edd’ )
);
return $required_fields;
}
add_filter( ‘edd_purchase_form_required_fields’, ‘pw_edd_purchase_form_required_fields’ );
—
I am not sure if the field and error ID I put in to modify the part of the code that came from the above link are correct, but they would seem correct.
Anyway, I just tested it on the site, nothing has changed, it is still not a starred (required) field, but I tried to do a checkout without confirming the email address and I got an error messages which says: “Error: Your email addresses do not match”.
That error message is taken from the first part of the code you provided and which is fine because it proves that your code is already working to make it a required field.
So for now I am going to take out the part of the code that I added using the above link because it doesn’t seem to be doing anything more.
The only thing missing is the star to let customers know it is a required field though. Perhaps there is a way to add something to your original code to add the star.