CHANGE STATE NAME TO POSTAL ABBREVIATION ON WOOCOMMERCE CHECKOUT PAGE USING HOOK IN WORDPRESS

159

This is another snippet on how to change State name to Postal Abbreviation in WooCommerce programmatically or using Hook, so you can make “Australian Capital Territory” display as “ACT” or “New South Wales” display as “NSW” and so on, while digging I found few in the net with same topic but I can say they don’t know what they’re doing, yaay they touch core file which they should not as it overwrite and wipe the changes every time WooCommerce release new updates.

This is helpful if you want to print mailing labels for your shipments which only accept Postal Abbreviation, so you don’t have to change it manually and search for correct abbreviation just to make sure you got the right one.

So much for that, let’s get started.

Code

Add the below code into your current themes functions.php file

That’s it, Happy Coding  🙂

Leave A Reply

Your email address will not be published.