Halloween Sale 15% off Ends in See the plans
PHP

"Confirm Email" Field at EDD Checkout

Asks guest buyers to type their email address twice on the Easy Digital Downloads checkout, preventing typos that would stop their download links arriving.

Don’t have WPIDE yet? Install it on your site

Code

add_action( 'edd_purchase_form_after_email', function () {
    if ( is_user_logged_in() ) {
        return;
    }
    ?>
    <p id="edd-email-confirm-wrap">
        <label class="edd-label" for="edd-email-confirm"><?php echo esc_html( 'Confirm email address' ); ?> <span class="edd-required-indicator">*</span></label>
        <input class="edd-input required" type="email" name="edd_email_confirm" id="edd-email-confirm" autocomplete="email" required>
    </p>
    <?php
} );

add_action( 'edd_checkout_error_checks', function ( $valid_data, $post ) {
    if ( is_user_logged_in() || ! isset( $post['edd_email'] ) ) {
        return;
    }

    if ( strtolower( trim( (string) $post['edd_email'] ) ) !== strtolower( trim( (string) ( $post['edd_email_confirm'] ?? '' ) ) ) ) {
        edd_set_error( 'wpide_email_mismatch', 'The email addresses do not match. Please check them.' );
    }
}, 10, 2 );

Notes

Logged-in customers do not see the extra field.

How to add this snippet

  1. Install WPIDE on your WordPress site (it is free) and open Code Snippets.
  2. Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
  3. It is added inactive: review the code and settings, then switch it on.

Have a snippet worth sharing?

Publish it to the library from WPIDE or right here. Sign in with any WordPress site that runs WPIDE, free or Pro. Public snippets are reviewed by the WPIDE team before they appear.

Which site should get this snippet?

Enter the address of your WordPress site. WPIDE opens there in a new tab with the snippet ready to review and save.

Remembered in this browser only, so you are asked once.

Report this snippet

Tell the WPIDE team what is wrong: broken code, something harmful, spam or copied work.