WooCommerce shop.
Setting "Customer can register while checkout" is ON, so customer have to fill his Name, Phone and Email while checkout (on /checkout/ page).
I want to check this data for errors before registration. So, I try to get this data from $_REQUEST variable or from $fields array from filter "woocommerce_after_checkout_validation", but I can't do this.
This is how I try:
    add_action( 'woocommerce_before_checkout_registration_form', 'check_request', 1 );
    function check_request () {
        echo '<pre>'; print_r($_REQUEST); echo '</pre>';
    }
    /* OUTPUT:
    Array
    (
        [woocommerce-login-nonce] => 
        [_wpnonce] => 
        [woocommerce-reset-password-nonce] => 
        [woocommerce-edit-address-nonce] => 
        [save-account-details-nonce] => 
    )
    */
And this:
    add_filter( 'woocommerce_after_checkout_validation', 'custom_after_checkout_validation', 10, 2);
    function custom_after_checkout_validation ($fields, $errors){
        if ( empty( $fields['billing_phone'] ) ) {
            $errors->add( 'phone validation', 'Phone is empty' );
        }
    }
    /* OUTPUT:
    Phone is empty
    */
Please, help me.
 
                        
Try This