Leave a Reply

1 comment

  1. You could try to use one of this 2 hooks for validating custom fields.

    add_action( 'user_profile_update_errors','wooc_validate_custom_field', 10, 1 );
    
    // or
    
    add_action( 'woocommerce_save_account_details_errors','wooc_validate_custom_field', 10, 1 );
    
    // with something like:
    
    function wooc_validate_custom_field( $args )
    {
        if ( isset( $_POST['custom_field'] ) ) // Your custom field
        {
            if(strlen($_POST['custom_field'])<4 ) // condition to be adapted
            $args->add( 'error', __( 'Your error message', 'woocommerce' ),'');
        }
    }