GithubHelp home page GithubHelp logo

hlashbrooke / woocommerce-email-validation Goto Github PK

View Code? Open in Web Editor NEW
13.0 13.0 5.0 128 KB

WooCommerce extension that adds a 'confirm email address' field to the checkout page

Home Page: http://hugh.blog

License: GNU General Public License v3.0

PHP 100.00%

woocommerce-email-validation's People

Contributors

ablears avatar heocoi avatar hlashbrooke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

woocommerce-email-validation's Issues

E-Mail-Adress-2 Field should be appended directly after E-Mail-Address

The add_checkout_field should look like the follows:

public function add_checkout_field( $fields = array() ) {
    $billing_email2 = array(
        'label'             => __( 'Confirm Email Address', 'wc_emailvalidation' ),
        'placeholder'       => _x( 'Email Address', 'placeholder', 'wc_emailvalidation' ),
        'required'          => true,
        'class'             => apply_filters( 'woocommerce_confirm_email_field_class', array( 'form-row-first' ) ),
        'clear'             => true,
        'validate'          => array( 'email' ),
    );
    $billing_email_index = array_search('billing_email', array_keys($fields['billing']));

    if( $billing_email_index ){
        $fields['billing'] = array_slice($fields['billing'],0,$billing_email_index + 1,true) +
            array( 'billing_email-2' => $billing_email2 ) +
            array_slice($fields['billing'],$billing_email_index + 1,null,true);
    } else {
        $fields['billing']['billing_email-2'] = $billing_email_confirm;
    }

    return $fields;
}

Avoid Validation under certain circumstances

Since the Amazon Payments plugin for WooCommerce is using their own forms, I need a possibility to prevent the mail validation.

Until now I just unset the email-2 field in the WC checkout fields, when a customer is logged in via Amazon.
That does not seem to work anymore, since my customers have problems to checkout because the validation function is called anyway.

Now I tried to remove the filter for the validation function, but it won't work.
remove_filter('woocommerce_process_checkout_field_billing_email-2', array('WooCommerce_Email_Validation', 'validate_email_address'), 10);

Do you have a hint how I can solve my problem?

Prevent text pasting in email confirmation field?

I'm not 100% sure this is a good idea as it adds a layer of inconvenience to the user, but it has been requested by more than one person now (here's the latest request). I understand the desire for this kind of thing, but I'm not sure it's good to add this kind of potential inconvenience to the user.

If I did add this feature then I would add an option for the site owner to activate it or not, so that it doesn't immediately affect users. It should be easy enough to achieve with jQuery's .bind("cut copy paste") function, but I'd need to test this out properly first.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.