Jump to content

forza11

New Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by forza11

  1. Thanks for reply. So you suggest to change this code if ( $email !== $_POST['confirm_email'] ) { to this one, right? elseif ( $email !== $_POST['confirm_email'] ) {
  2. Hello there, I use below code snippet in woocommerce to confirm emails. It creates a php error as below. How I can solve it? "[09-Nov-2022 07:55:09 UTC] PHP Warning: Undefined array key "confirm_email" in /srv/htdocs/wp-content/themes/generatepress_child/functions.php on line 846" /** * Snippet Name: WooCommerce Confirm Email On Registration Form * Snippet Author: ecommercehints.com */ // Create the field and display it on the registraiton form add_action('woocommerce_register_form', 'ecommercehints_registraion_form_confirm_email_field'); function ecommercehints_registraion_form_confirm_email_field() { woocommerce_form_field( 'confirm_email', array( 'type' => 'text', 'required' => true, 'label' => 'E-posta adresi tekrar', ), (isset($_POST['confirm_email']) ? $_POST['confirm_email'] : '') ); } // Show an error message if the confirm email field is empty or doesn't match the billing email field add_action('woocommerce_register_post', 'ecommercehints_confirm_email_field_validation', 10, 3); function ecommercehints_confirm_email_field_validation($username, $email, $errors) { if (empty($_POST['confirm_email'])) { $errors->add('confirm_email_error', 'Lütfen e-posta adresinizi iki alana da girin!'); } if ( $email !== $_POST['confirm_email'] ) { $errors->add('confirm_email_error', 'Girdiğiniz e-posta adresleri birbiri ile aynı değil!'); } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.