Skip to content
Advertisement

WooCommerce custom localization address format for specific country

I am printing address labels from WooCommerce and find that the line breaks for the addresses are not as I need them.

I found the code I need to change in woocommerce_localisation_address_formats hook and have added the line break but I do not know enough to add the correct code to the functions file thus avoiding going back to the old format on the next update.

This is the corrected replacement line:

JavaScript

Any help is appreciated.

Advertisement

Answer

You need to use woocommerce_localisation_address_formats filter hook as follows:

JavaScript

Code goes in functions.php file of the active child theme (or active theme). Tested and works.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement