• Resolved faustharrison

    (@faustharrison)


    Hello,
    I am trying to do change the text in my checkout page where it says “ZIP” to say “5 Digit ZIP”.

    You will have to have something in your cart to see this in the checkout page.
    Goto this page and ad something into your cart first then proceed to checkout:

    https://faustharrisonpianos.com/shop/

    I am not able to locate where the label for ZIP is located in cPanel so I can change the text or even put something in the place holder text box.

    The place holder box appears to be in the class=”woocommerce-input-wrapper” which I cannot find either.

    Does anyone know where these are located? Any help would be great.
    Thanks

    <label for=”billing_postcode” class=””>ZIP <abbr class=”required” title=”required”>*</abbr></label>

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @faustharrison!

    You can use the following code to change the label and placeholder

    add_filter( 'woocommerce_checkout_fields' , 'my_override_checkout_fields' );
    
    function my_override_checkout_fields( $fields ) {
    	 $fields['billing']['billing_postcode']['label'] = 'Postal Code';
         $fields['billing']['billing_postcode']['placeholder'] = 'Postal Code';
         return $fields;
    }

    You can add this code using a free plugin like Code snippets (https://wordpress.org/plugins/code-snippets/) or to your child theme’s functions.php file. Please don’t add custom code directly to your parent theme’s functions.php file as this will be wiped entirely when you update

    Cheers!

    Thread Starter faustharrison

    (@faustharrison)

    Thank you for the reply.
    When I tried this using Code Snippets I received an error in line 1.

    Any additional help would be grateful.
    Thanks

    Isn’t there a way using CSS to change what the placeholder says?

    mother.of.code

    (@imazed)

    The Mother of Code

    Hey @faustharrison – the code looks good to me. Is there any other code present in the Code Snippet file that you’re using?

    Thread Starter faustharrison

    (@faustharrison)

    Hello, yes and thank you for this. The code snippet works.
    I was having a conflict with another third party WooCommerce plugin (actually one of the setting options).
    Super appreciated and thanks again!

    Thread Starter faustharrison

    (@faustharrison)

    Is it possible to limit the Postal Code to only 5 digits?

    I found that adding maxlength=”5″ works in google’s inspect element, but I don’t know how to write the actual code snippet:

    <input type=”text” class=”input-text ” maxlength=”5″ name=”billing_postcode” id=”billing_postcode” placeholder=”5 Digit Zip Code” value=”12345″ autocomplete=”postal-code”>

    Thank you!

    Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi @faustharrison!

    Is it possible to limit the Postal Code to only 5 digits?

    You can add ['maxlength'] = 5;

    Cheers!

    Thread Starter faustharrison

    (@faustharrison)

    Perfect thanks! Didn’t know it was that simple.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Label “billing_postcode” in Checkout’ is closed to new replies.