How To Change The Postcode To Eircode and Make it Required in WooCommerce

Published: January 11, 2021,  
Posted in: ,  

I had a request from a client today to change the Postcode field in the WooCommerce checkout page to a required field and to rename it to 'Eircode'. After some trial and error, the following two snippets worked a treat.

1. Make the Postcode field required

We do this by adding the following code snippet to the site:

// Make Postcode Required for all Countries
add_filter('woocommerce_get_country_locale', function($locales){
    foreach ($locales as $key => $value) {
        $locales[$key]['postcode']['required'] = true;
    return $locales;

2. Rename the Postal Code field to 'Eircode'

Add the following snippet to the site:

add_filter( 'woocommerce_checkout_fields', 'ifd_rename_woo_checkout_fields' );
function ifd_rename_woo_checkout_fields( $fields ) {
    $fields['billing']['billing_postcode']['placeholder'] = '';
    $fields['billing']['billing_postcode']['label'] = 'Eircode';
    return $fields;

I hope you find this useful but let me know if you have any trouble implementing it.

4 comments on “How To Change The Postcode To Eircode and Make it Required in WooCommerce”

  1. Just to let you know, I found this very helpful. I used the snippet of code on two websites for a client of mine. Thanks for sharing!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get Notified Of New Posts
Copyright © 2022 All Rights Reserved  |  By Itchy Fingers Design
twitterfacebookenvelopelinkedinxinglong-arrow-leftlong-arrow-rightpaper-planepinterest-pwhatsappcommentingchevron-down linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram