Search
 
SCRIPT & CODE EXAMPLE
 

PHP

woocommerce checkout manager confirm password

add_filter( 'woocommerce_checkout_fields' , 'add_confirm_password_checkout_field', 10, 1 );
function add_confirm_password_checkout_field( $fields ) {
    if ( get_option( 'woocommerce_registration_generate_password' ) != 'no' )
        return $fields;

    $fields['account']['account_password']['class'] = array('form-row-first');
    $fields['account']['account_password-2'] = array(
        'type' => 'password',
        'label' => __( 'Password confirmation', 'woocommerce' ),
        'required'          => true,
        'placeholder' => _x('Confirmation', 'placeholder', 'woocommerce'),
        'class' => array('form-row-last'),
        'label_class' => array('hidden')
    );
    return $fields;
}

add_action( 'woocommerce_checkout_process', 'confirm_password_checkout_validation' );
function confirm_password_checkout_validation() {
    if ( ! is_user_logged_in() && ( WC()->checkout->must_create_account || ! empty( $_POST['createaccount'] ) ) ) {
        if ( strcmp( $_POST['account_password'], $_POST['account_password-2'] ) !== 0 )
            wc_add_notice( __( "Passwords doesn’t match.", "woocommerce" ), 'error' );
    }
}
Comment

PREVIOUS NEXT
Code Example
Php :: SMTP - ERROR: Failed to connect to server: Connection refused (111)SMTP Connect() failed. 
Php :: display image from mysqli database 
Php :: adeleye ayodeji 
Php :: how to display the database table names list in codeigniter 
Php :: moodle get course image 
Php :: how to delete empty rows in phpmyadmin 
Php :: Laravel stop on first validation error 
Php :: laravel when condition 
Php :: laravel where equal 
Php :: trim specific character from strin using php 
Php :: 301 redirect 
Php :: php array to array collection 
Php :: is serialized php 
Php :: Eloquent models events 
Php :: wp reserved image size name 
Php :: php description limit 
Php :: check if array is empty php 
Php :: how to write tests for php 
Php :: wc php if is product category page 
Php :: cakephp 4 change layout view in a method 
Php :: php array viewer 
Php :: set custome table laravel eloquent 
Php :: autoload file laravel 
Php :: select multiple option in laravel 
Php :: php PDO howto columns from table 
Php :: laravel Impossible to create the root directory 
Php :: Genrate Random Integer 10 digits in php 
Php :: filter array in php with passing extra params 
Php :: laravel the requested url was not found on this server 
Php :: php validate colour 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =