How to add email confirmation field on checkout page?

by Peter D.

You can add the following code to the custom javascript file of your theme:

document.observe('dom:loaded', function() {
  var email = $('billing:email');
  if (!email || !email.up('li')) {
    return;
  }

  email.up('li').insert({
    'after': '<input placeholder="Enter your email again please" class="input-text required-entry validate-both-emails" type="text">'
  });

  Validation.add(
    'validate-both-emails',
    'Email did not match the email above',
    function(v, input) {
      var dependentInput = $('billing:email'),
          isEqualValues  = input.value == dependentInput.value;

      if (isEqualValues && dependentInput.hasClassName('validation-failed')) {
        Validation.test(this.className, dependentInput);
      }

      return isEqualValues;
    }
  );
});

Recent articles

Get Discount!

Get your personal discount !

Like us on Facebook, post a Tweet or rate us at Google Plus to get instant 10% OFF on any purchase from our store.

Please make your choice
Discount Coupon Code

Back to top