Turn Off Localization Temporarily in WooCommerce

I’m working on a site that’s in Japanese.  It’s a huge WooCommerce shop and they have a lot of custom meta fields we built for the English version of things.  Customers have their first and last name in my account and also fields we made for English First Name and English Last Name.

On the Addresses endpoint of WooCommerce’s “My Account” section we wanted to display the names/addresses in both Japanese and English.  This seemed easy except the Japanese state name that’s generated by Woo was being translated in the ‘woocommerce’ text domain.  The work-around was to unload the text domain, reload the countries/states instance with the data, get our state then reload the text domain.  This snippet did the trick:

https://gist.github.com/ChrisFlannagan/423cb29c9ffe9a55baa2e955add81ba6

Leave a Reply

Your email address will not be published.