When it comes to arranging shipping to/within the United Kingdom, the Netherlands, Canada, or the Republic of Ireland – i.e. countries with alphanumeric zip codes –their validation can become a predicament in Magento 2. As a result, you will be unable to configure shipping rates and rules conditions correctly.
Let’s learn more about alphanumeric postal codes validation, and how Shipping Suite Ultimate by MageWorx helps deal with it.
Table of Contents
What are alphanumeric zip codes?
The majority of postal code systems are numeric, i.e., made of digits. Alphanumeric postal codes use both letters and digits, and normally encode many more locations than numeric postcodes. This happens because such zip codes are assigned to smaller and more specific locations, such as blocks, for instance.
Take a look at this explanation of Canadian alphanumeric postal codes by a Quora user, to have a better idea:
According to Wikipedia, there are currently 11 locations that use alphanumeric zip codes: Argentina, Brunei, Canada, Ireland, Kazakhstan, Malta, the Netherlands, Peru, Somalia, the United Kingdom, and Swaziland. Thus, if your Magento 2 store does business with/within these locations, make sure to dwell on.
How does Magento 2 postcode validation work by default?
By default, during the process of postcode validation, Magento 2 compares each one-digit postcode number/letter with the ones entered in the backend settings, i.e. the elements are analyzed one-by-one. As a result, when it’s required to view the elements as a group, inaccuracy will occur. If we conventionalize the process of postcode validation, this is how it’ll look like by default:
What can be done to deal with such limitations?
Shipping Suite Ultimate offers the possibility to expand the default functionality by grouping postcode elements.
This will allow comparing them within the specified sections, rather than one-by-one. In the example picture offered on the left, you see a Scottish postcode. The extension will check the letters specified in the area section first. If it coincides with the shipping settings you’ve entered, then the verification process will move further to the district section, and so on. Surely, the configuration process is more advanced as numerous combinations happen to be.
How to set up alphanumeric postcodes in Shipping Suite Ultimate?
By default, the functionality is disabled. This is done to avoid automatic unexpected changes in logic that may occur after the installation/update of the extension.
To enable Shipping Suite in your Admin Panel, go to Stores > Configuration > MageWorx > Shipping Suite > Validation Settings. You’ll see the Advanced Postcode Validation: Is Enabled tab. After you select ‘yes’, you’ll be able to set and divide postcodes into groups.
The Advanced Postcode Validation: excessive data means postcode is valid tab allows defining how postcodes with a different number of elements will be handled. When enabled, the specific parts of postcodes get to be used during the validation process. For example, you may want to set only area code to cover all the locations within it.
If you wish to enable advanced conditions for alphanumeric postcodes when setting rules conditions, make sure to select ‘yes’ in the Enable advanced conditions for United Kingdom postcodes validation tab.
Oh, don’t forget to clear your cache after making any changes. As obvious as it might sound, this step is often omitted by the Store Admins when configuring the extension:
Take a look at this brief video guide to have a better idea about this small yet critical for correct shipping settings functionality:
As many as 11 countries currently have alphanumeric postcodes. Their correct validation and set up are critical for Magento 2-based sites that are doing business within those locations or ship to them. This process can be made easy, accurate and error-free with the help of MageWorx Shipping Suite Ultimate.
In case you’ve got any suggestions or thoughts about this article, feel free to leave a comment below.