Rename Country Codes in WooCommerce2

How to Easily Rename Country Codes in WooCommerce

Have you ever wanted to change how country names appear in your WooCommerce store? Maybe you need a shorter country code or a different language for customer clarity. Fortunately, WooCommerce makes customizing country codes a straightforward process.

 

Explore our full range of WooCommerce plugins here

 

Step-By-Step Guide to Renaming Country Codes In WooCommerce

 

Understanding Country Codes

 

Country codes are essential for ensuring accurate shipping, billing, and overall customer experience in WooCommerce. They follow the ISO 3166-1 alpha-2 standard, which means each country has a unique two-letter code (e.g., “US” for the United States, “CA” for Canada).

 

Whenever a customer enters their address, WooCommerce uses these codes to match the appropriate country. This helps determine shipping rates, taxes, and even display region-specific information.

 

Locating the functions.php File:

 

Your theme’s functions.php file is where you can add small snippets of code to modify how WooCommerce works. Let’s find it:

Method 1: Via Your WordPress Dashboard

 

  1. Log in to your WordPress Dashboard.
  2. On the left-sidebar, go to Appearance -> Theme Editor.
  3. On the right, you’ll see a list of theme files. Look for functions.php (Theme Functions). Click on it to open.

Rename Country Codes in WooCommerce

 

Method 2: Via an FTP/File Manager

 

  1. Access your website’s files using an FTP client (like FileZilla) or your hosting provider’s file manager.
  2. Navigate to your theme’s root folder (often inside /wp-content/themes/your-theme-name/).
  3. Find and open the functions.php file.

 

Rename Country Codes in WooCommerce2

 

IMPORTANT: Child Themes

Before making any changes, it’s strongly recommended to use a child theme. This prevents your customizations from being lost when you update your main theme.

Adding the Code Snippet

 

Let’s do the rename! Copy and paste the following code at the bottom of your functions.php file:

 

Plain text version of the above:

 

PHP


function rename_country_code( $countries ) {
// Rename "US" (United States) to "USA"
$countries['US'] = 'USA';


// Add more renaming cases if needed:
// $countries['XX'] = 'YY'; // Where 'XX' is the old code, 'YY' is the new code


return $countries;
}
add_filter( 'woocommerce_countries', 'rename_country_code' );

Understanding the code:

 

  • The first line connects a new function (which we’ll define below) to WooCommerce’s list of countries.
  • my_country_rename is the name of our function. Feel free to change it to something that describes your specific change.
  • Inside the function, we change the ‘US’ country code to ‘United States’. This part is where you’ll make your edits.

 

Customizing for Your Needs

 

Make it your own:

  1. Replace ‘US’ with the two-letter code of the country you want to rename.
  2. Replace ‘United States’ with the new name you’d like to display on your store.

 

WooCommerce Country Code Rename FAQs

 

What is a country code?
Country codes are standardized two-letter abbreviations that represent countries and territories around the world (e.g., “GB” for Great Britain, “DE” for Germany). These codes, defined within the ISO 3166-1 alpha-2 standard, are a crucial part of online stores, ensuring they can process customer addresses accurately for shipping and billing.

 

How do I change the default country code in WooCommerce?
In WooCommerce, you can’t technically change the overall default country for your entire store. However, you have the flexibility to rename specific countries as needed. This lets you customize how they appear to your customers during checkout and within their account information.

 

What countries does WooCommerce support?
WooCommerce is designed to support virtually all countries across the globe. You can find a comprehensive list of ISO 3166-1 alpha-2 country codes to check if your required country is included. Keep in mind, the renaming process we’ve outlined works for any country supported by WooCommerce.

 

Additional Considerations – Potential Conflicts

 

While renaming country codes is usually straightforward, it’s good to be aware that custom code changes can sometimes lead to unexpected conflicts, especially in stores with lots of plugins or complex setups. If you run into any issues, it’s sometimes best to consult a WooCommerce developer for help.

 

In Closing

 

While the process of renaming country codes in WooCommerce is relatively simple, tailoring your store to customers in different regions can get far more intricate.

 

If you need to set different product prices based on location, hide certain products from specific countries, or have other complex location-based customizations in mind, consider exploring Aelia’s Prices by Country for WooCommerce plugin.

 

This powerful tool gives you granular control over your product pricing and visibility based on customer location.

 

Want to learn more or need help with advanced WooCommerce customizations? We’d love to hear from you!

news icon

Product updates – Compatibility with the WooCommerce High Performance Order Tables (HPOS) feature

The Aelia plugins are now compatible with WooCommerce High Performance Order Storage (HPOS) feature

We are happy to announce that, starting from the 11th of July, we will be releasing an updated version of all our plugins, which we tested for compatibility with the new HPOS feature provided by WooCommerce.

What is the HPOS feature?

Ad described in the WooCommerce documentation:

High-Performance Order Storage (HPOS) also previously known as “Custom Order Tables” is a solution that provides an easy-to-understand and solid database structure – specifically designed for eCommerce needs. It uses the WooCommerce CRUD design to store order data in custom tables – optimized for WooCommerce queries with minimal impact on the store’s performance.

This new feature aims at improving the performance of the checkout page, as well as the management of orders and generation of reports. Behind the scenes, the HPOS feature relies on new database tables that contain order data, structured in a more efficient way than the “legacy” post tables used by WordPress.

How does the HPOS feature affect the Aelia plugins?

Most of our plugins have been compatible with the HPOS feature for a while, as they rely on the functions provided by WooCommerce to access order data. These functions provide an abstraction layer, which ensures that plugins that call them will receive the expected data once the HPOS feature becomes the standard. We ran a series of tests, to be on the safe side, and we were able to confirm that the logic in our plugins works just fine with the new feature, as well as the legacy tables. We didn’t have to make significant changes to most of our solutions.

The most complex of our plugins, the Aelia Currency Switcher, required more work. That plugin is tightly integrated with the WooCommerce core, and, due to some design choices made to improve its performance, it had to access the database directly in a couple of cases. We rewrote the sections of the plugin that were affected by the upcoming changes and we implemented a fallback mechanism for sites that use the legacy tables. The switch between the two mechanisms is completely transparent to the user, and it occurs automatically when the HPOS feature is enabled or disabled. Thanks to this new architecture, the Currency Switcher is now compatible with the HPOS feature, while still retaining full compatibility with the legacy order tables.

Screenshots

Below you can find a few screenshots showing a couple of changes in the Aelia Currency Switcher interface. Although minor, they were an important step to improve the user experience and to ensure compatibility with the new pages (Edit Order, Orders List, Reports) introduced by the HPOS feature.

Aelia Currency Switcher - HPOS Compatibility - Orders list page

The new Orders List page shows the order totals in the original order currency and in the shop’s base currency, just like the legacy page did.

Aelia Currency Switcher - HPOS Compatibility - Orders import UI

The Currency Switcher now offers a simple interface to import the order data into the sales reports and analytics.

Aelia Currency Switcher - HPOS Compatibility - New install and upgrade logic

We rewrote the installation process to run in the background and process the data more efficiently.

Aelia Currency Switcher - HPOS Compatibility - Action Scheduler

The new installer included in the Currency Switcher relies on the robust Action Scheduler provided by WooCommerce.

What are the steps to enable the HPOS compatibility in the Aelia plugins?

The new versions of our plugins will enable the HPOS compatibility automatically, as soon as you install them. All our plugins retain full backward compatibility with the legacy order tables.

When will the updates become available?

As anticipated, we started rolling out the updates for our plugins on the 11th of July. You will see a notification in your WordPress dashboard when the new version of a plugin becomes available for your site.

💡 Important

The HPOS feature has been available since WooCommerce 7.1 and it changed slightly since its first release. Our tests indicate that the new feature is stable, and that our plugins work fine with it. However, we always recommend to test all the updates on a staging copy of your site first. We also recommend to take a full backup of your live site before enabling that feature on it, just to have an additional “safety net” in case of unexpected issue. If you encounter any issue, or come across an edge case scenario, please reach out to us, and we will look into it as soon as possible.

Conclusion

This new update will help your WooCommerce shop grow, thanks to the improved performance. The Aelia plugin will integrate seamlessly with the new High Performance logic and offer a smooth experience to both you and your customers.

Any questions?

As always, if you have any questions, or need assistance using our solutions, please feel free to contact us. We will be happy to assist you.

 

The Aelia Team

news icon

Aelia plugins – Performance improvements and PHP 8.2 compatibility

In this post, we’re going to discuss the improvements we made to our products to deal with the breaking changes introduced by PHP 8.2, as well as the possible issues that you might encounter. If you’re not familiar with the PHP programming languages and the technical aspects of WordPress and WooCommerce, we recommend to involve your developer to fully understand the topics we will cover.

news icon

The Aelia Shipping Pricing Addon is now included in the Aelia Currency Switcher

We are pleased to announce that the Aelia Shipping Pricing plugin, originally distributed as a separate addon for the Aelia Currency Switcher, will been bundled with the main plugin starting from version 4.11.x of the Currency Switcher. We took the decision of merging the two plugins after reviewing our sale statistics. The vast majority of our customers use both plugins together, therefore it made sense to release them as a single product.

This new distribution model brings several advantages:

  1. Easier maintenance. The licence for the Currency Switcher covers both the main plugin and the addon, so you won’t have to remember to renew two of them.
  2. Easier updates. The Shipping Pricing addon will “follow” the Currency Switcher at every update, reducing the chance of issues caused by old versions that were not updated.
  3. Lower price. The Aelia Currency Switcher with the Shipping Pricing addon included is cheaper than the current price of the two separate plugins.

What this means for our customers

If you’re using the Aelia Currency Switcher with the Shipping Pricing Addon as a separate plugin, you will soon see a notice informing you that the addon has been bundled with the Currency Switcher. The notice will look like the following:

The plugin “Aelia Shipping Pricing for Currency Switcher” is now included with the Aelia Currency Switcher

This plugin is now included in the Aelia Currency Switcher and no longer has to be installed separately. You can go to the Plugins page, then disable and remove plugin “Aelia Shipping Pricing for Currency Switcher”. Its features will remain available, as they were before.

As indicated in the message, you will just have to go to WordPress Admin > Plugins and disable the Shipping Pricing Addon. The features originally provided by that plugin will remain available via the Currency Switcher, exactly as they were before.

If you’re using only the Currency Switcher, you won’t have to do anything. You will just find the new features in the WooCommerce > Settings > Shipping page, after opening a shipping zone. Below you can find some screenshots of the Shipping Pricing Addon in action:

How this affects your licences

Your licence for the Aelia Currency Switcher will allow you to download the new version, including the Shipping Pricing features, automatically. When the licence for the Shipping Pricing addon  will expire, you will not have to do anything. In fact, you can simply delete the Shipping Pricing addon from your site after updating the Currency Switcher. As indicated, the main plugin now includes all the features from the shipping addon.

Any questions?

If you have any questions, please feel free to contact us, we ill be ready to assist you.

The Aelia Team

news icon

The Aelia Tax Display by Country plugin is now available directly from our site

The Aelia Tax Display by Country plugin was originally sold via CodeCanyon. We’re currently reorganising our business and, as part of the operation, we are going to consolidate our offer and move all our products to a single, new licensing system. The new system will allow us to manage product licences, updates and support more efficiently, as well as resume sales to UK consumers and non-VAT registered business. As part of the consolidation process, we had to remove the Tax Display by Country plugin from the CodeCanyon marketplace.

The Tax Display by Country plugin is still in active development and compatible with the latest version of WooCommerce. The Aelia Tax Display by Country plugin is currently available directly from our shop: https://aelia.co/shop/tax-display-by-country-for-woocommerce/. When we will move the product to the new licensing system, you will have the option to transfer your licence to it and retain access to our updates and support service.

Update – 04 May 2021 13:00 CEST

Some users reported that the removal of the Tax Display by Country plugin from the CodeCanyon marketplace was sudden. We had planned to announce the change in the next few weeks, and move our Tax Display plugin to the new platform in June. Yesterday, we have been informed that CodeCanyon updated the guidelines for the products sold via their marketplace. Our solution complies with the new guidelines, with the exception of a few minor elements that don’t affect its functionalities. Despite that, the Envato Team chose to disable our product, without warning, pending a review.

Although we understand the new guidelines, and we would be happy to follow them, we don’t agree with the sudden removal of our product from the CodeCanyon marketplace. Our solution runs on thousands of our customers’ sites, and works perfectly with the latest version of WordPress and WooCommerce. We would have appreciated, and considered more professional, if they informed us, and gave us sufficient notice to address the discrepancies.

Due to this, and to the fact that we had already planned to move our product to another platform, we decided to start the migration process immediately. We considered this approach more effective than trying to rush an update, push for a review, and get the product back online on CodeCanyon just for a few weeks.

How this change could affect you

The policies applied by the Envato/CodeCanyon grant access to six months of support from the date of purchase. If you bought the Aelia Tax Display by Country plugin from that marketplace and have an active support service, simply contact us, with your purchase code (see Envato –  Where is my purchase code?). We will provide you with support for the remainder of the covered period.

If you don’t wish to avail of our support service, and you have a valid CodeCanyon purchase code, you can still get access to updates for the Tax Display by Country. To do so, please forward us the original purchase code via our contact form and we will send you the instructions to keep receiving the updates.

What are the differences in terms of licensing, support and updates?

The terms of licensing offered by CodeCanyon are different from the ones that we offer via our website. You can find a quick comparison below.
Result (click “Generate” to refresh) Copy to clipboard Preview

AeliaCodeCanyon
Licence typeGPL . You are allowed to install and activate the plugin on as many sites as you like (see Benefits of the GPL licence)CodeCanyon’s Standard Licence. The licence allowed users to install the plugin on a single site (see https://codecanyon.net/licenses/standard). The terms of sale of the marketplace prohibited using the plugin on multiple sites.
UpdatesAutomatic updates are provided for one site per licence. You can install the plugin on other sites, which you have to have to update manually. The licence includes updates for one year. After that period the licence has to be renewed to receive further updates.Automatic updates were provided for one site per licence. CodeCanyon granted access to updates for the lifetime of the product. “Lifetime” meant until the product was retired, or removed from the CodeCanyon marketplace, as it happened in this case.
SupportThe support service is available for the duration of the licence, which is one year.Access to the support service was available for six months from the date of purchase. It had to be renewed every six months.

Update – October 2021

On the 1st of October, 2021, we moved all our products to the Freemius platform. The same terms described in the Aelia column, above, still apply to the products after the migration.

What happens after the support service bought from CodeCanyon will expire?

When the support service you bought from CodeCanyon will expire, you will just have to get a new licence from our site. This will grant you another year of updates and support.

Any questions?

If you have any questions, please feel free to contact us at any time. We will be happy to give you all the information you need. Thanks.

The Aelia Team

Business All-Stars Accreditation Logo 2020-White Background

Aelia Receives All-Star Quality Mark from AIBF for the second year in a row

Our beloved Grinzing, located in one of the most beautiful districts of Vienna, has received a massive boost this week with one of the resident businesses achieving international recognition for excellence, confirming its highest standards of service and trust. Diego Zanella, the founder of Aelia, was awarded the coveted All-Ireland Business All-Star accreditation for the second year in a row. One might ask why an Austrian business, founded by an Italian entrepreneur, would receive such an important accreditation from a foreign country, and it would be a legitimate question. The answer is simple, yet interesting.

Some background story

Diego Zanella founded Aelia in Ireland, in 2013. From the first day, he founder focused all its efforts in producing high quality solutions, and offering top class service, to owner of e-commerce websites. Thanks to the flexibility offered by modern technologies, the business can operate from anywhere in the world, while still keeping in touch with its thousands of customers. Aelia moved around Ireland a couple of times, then, in mid-2019, Diego Zanella planned a relocation to Austria.

The All-Ireland Business Foundation came into play, just in time

At the beginning of the same year, he had submitted Aelia to the selection for the Business All-Star accreditation. He was supposed to receive answer was supposed within a couple of days, and the selection process take a few weeks. However, due to a technical issue, the submission remained “pending” much longer than it should have. As soon as the All-Ireland Business Foundation Team found it, they reviewed the performance of both Aelia and its founder. The score was high enough to place them amongst the top candidates.  Even though our founder informed the AIBF Team of the imminent relocation abroad, they were more than happy to let our application proceed anyway. Then, in October 2019, Diego Zanella received the first Business All-Star accreditation.

In 2020, the AIBF Team contacted our founder again. Although our Aelia and its founder are no longer resident in Ireland, their result were so high that the Foundation offered to make an exception, and participate to the selection again. Diego Zanella was given the opportunity to become the first “ex-indigenous entrepreneur” to be accredited by the All-Ireland Business Foundation.

Obviously, since we’re writing about it, the result was a success. At the end of October 2020 (yes, we’re a bit slow with news), Aelia’s founder received the accreditation certificate, confirming Diego Zanella as a Thought Leader in e-commerce and WooCommerce solutions.

Aelia - Certificate of Accreditation 2020

Aelia – Certificate of Accreditation 2020

Due to the ongoing COVID-19 pandemic, the Gold Medal Ceremony was replaced by an online event. Our founder, Diego Zanella, attended it on the 30th of October, 2020.

The importance of get accredited for the second year

Like in 2019, we are pleased to have reached the high standard required by the the Business All-Star accreditation. We strive to keep high level of performance, trust and customer satisfaction that distinguishes our offer . Furthermore, we are the first to having been invited to participate into the selection, despite the business being now resident in another EU country, and it feels like a special honour. The All-Ireland Business Foundation is so impressed by our results that they would like to keep us in their register of top class companies. 👍

We would like to thank everyone for your continued support. Our customers, who keep trusting, our business partners, with whom we will be working on more incredible projects and, most importantly, our families.

Thanks again for your invaluable help. We wouldn’t be here, if it weren’t for you. 🙏

The Aelia Team