You will be with me that one of the most common mistakes made by customers of an online store , and on almost all websites, is when entering their email correctly .
And of course, then what happens happens …
- They do not receive the confirmation of account creation
- Order confirmations do not arrive
- Shipping tracking does not reach them
- The invoices do not arrive
- They do not get ANYTHING … because you put the email wrong so cazurrooooooo!
Ok, I’m more relaxed …
It is a reality, the client at the end of the purchase is more aware of entering the bank details or that the order is what they wanted, than of filling in the fields (mandatory and essential) to manage their order, their billing, etc.
And they make a lot of mistakes.
Well, a great way to avoid these errors when entering the email is to add another field, for a double verification , and that if they make a mistake when entering the email again, an error will appear , until you put it correctly in the two fields (or badly in the two fields, which I have also seen).
A quick and easy way to add this additional email verification field on the checkout page would be using this code:
/ * Field to confirm email at the end of purchase * / add_filter ('woocommerce_checkout_fields', 'helpwp_confirm_email_finish_purchase'); function helpwp_confirm_email_complete_purchase ($ fields) { $ fields ['billing'] ['billing_email'] ['class'] = array ('form-row-first'); $ fields ['billing'] ['billing_em_ver'] = array ( 'label' => 'Confirm email', 'required' => true, 'class' => array ('form-row-last'), 'clear' => true, 'priority' => 999, ); return $ fields; } // Error message if the emails are different add_action ('woocommerce_checkout_process', 'help wp_check_doble_email'); function help wp_check_double_email () { $ email1 = $ _POST ['billing_email']; $ email2 = $ _POST ['billing_em_ver']; if ($ email2! == $ email1) { wc_add_notice ('Your email addresses do not match', 'error'); } }
You can add this code to the functions.php
file of the active theme or to your own customization plugin .
You will go from this:
To this other:
Easy huh?
YOU MAY ALSO BE INTERESTED IN …
Did you like this article? You can’t imagine what you’re missing on YouTube !