• Resolved markk26

    (@markk26)


    Does this plugin check if the CPF and CEP are valid?
    How can I use it on the registration page and also on the checkout page of Woocommerce?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Petermann

    (@ivanpetermann)

    Hi @markk26,

    This plugin only add mask.

    Script to add mask in input on WooCommerce – JavaScript or PHP.

    https://gist.github.com/petermann/fd1a898e02ca91a0d7231a9f8ee662b4#file-script-to-add-mask-in-input-phone-the-woocommerce-javascript-or-php

    Thread Starter markk26

    (@markk26)

    So would I just have to publish the plugin to add this code to my functions.php of my theme? :

    */
    add_action(‘wp_footer’, function () {echo “<script type=\”text/javascript\”>jQuery(document).ready(function($){ $(\”input[name=’billing_phone’]\”).mask(‘(000) 000-0000’); });</script>”;}, 111);

    Instead of billing_phone would it be billing_cep or billing_cpf?

    Plugin Author Petermann

    (@ivanpetermann)

    Hi @markk26

    Yes, try this.

    
    add_action('wp_footer', function () {
        echo "<script type=\"text/javascript\">
        jQuery(document).ready(function($) {
            $(\"input[name='billing_cpf']\").mask('000.000.000-00');
            $(\"input[name='billing_postcode'], input[name='shipping_postcode']\").mask('00000-000');
        });
    </script>";
    }, 111);
    

    or

    
    add_action('wp_footer', function () {
        echo "<script type=\"text/javascript\">
        jQuery(document).ready(function($) {
            $(\"input[name='billing_cpf']\").addClass('cpf');
            $(\"input[name='billing_postcode'], input[name='shipping_postcode']\").addClass('cep');
        });
    </script>";
    }, 111);
    
    • This reply was modified 3 years, 12 months ago by Petermann.
    • This reply was modified 3 years, 12 months ago by Petermann.
    Thread Starter markk26

    (@markk26)

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘CPF validation’ is closed to new replies.