• Resolved bencevilagi

    (@bencevilagi)


    Hi,

    How can I set the maximum length of the Vat number field? I would like to set it to max 11 character.

    Thank you,
    Bence

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Algoritmika

    (@algoritmika)

    Hi @bencevilagi,

    Wasn’t possible, but I’ve just added it to the plugin. Please update the plugin to the latest version 1.7.2 and then you will find new “Max length” option in “WooCommerce > Settings > EU VAT > General > Frontend Options”.

    Please let me know if it’s not working as expected or if you have any questions. And if you like the plugin, please consider leaving me a rating.

    Thread Starter bencevilagi

    (@bencevilagi)

    Thank you, it works!

    I have an other question, is it somehow possible to set that customers can only write numbers to the field?

    Thank you!

    Plugin Author Algoritmika

    (@algoritmika)

    Hi @bencevilagi,

    I will think about adding it to the plugin. Meanwhile, you can do it with a small JavaScript code. You can use any tool for adding custom JS code, but I would suggest using our another small Custom CSS, JS & PHP plugin for that. After installing, you will need to go to “Tools > Custom CSS, JS & PHP”, locate “JS: front-end” option there, set position to “Load in footer” and set “JS code” option to:

    
    document.querySelector( "#billing_eu_vat_number" ).addEventListener( "keypress", function( evt ) {
        if ( evt.which < 48 || evt.which > 57 ) {
            evt.preventDefault();
        }
    } );
    

    Please let me know if it’s not working as expected or if you have any questions.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Set max length’ is closed to new replies.