skip to Main Content

How can I to force the input of the postcode field in WooCommerce account page into upper case, so if someone inputs rh12 3uc it makes it into RH12 3UC?

2

Answers


  1. add_action('wp_footer', 'postcode_toupper');
    
    function postcode_toupper(){
        echo '<script>jQuery(function($) {$("#billing_postcode").keyup(function() {  this.value = $("#billing_postcode").val().toUpperCase();    });});</script>';
    }
    

    Add this code in your active theme functions.php

    Login or Signup to reply.
  2. I tend to use CSS text-transform: uppercase;

    For the element id ‘billing_postcode’ use…

    #billing_postcode {text-transform: uppercase;}
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search