WooCommerce - Set Maxlength to checkout field

In your functions.php include:

add_action("wp_footer", "cod_set_max_length");




function cod_set_max_length(){
if( !is_checkout())
return;
?>

<script>

jQuery(document).ready(function($){

$("#billing_address_1").attr('maxlength','20');
$("#billing_address_2").attr('maxlength','20');
// more fields

});

</script>

<?php

}

No comments

Powered by Blogger.