Improved State/Region Handling
- Enhanced the handling of state/region codes to better support countries with non-standard formats.
- Updated the logic for generating and storing
MOJOISO31662
codes in theoxstates
table:- Now checks if existing
OXISOALPHA2
already matches the expected format before generating values. - Supports countries like Mexico that may require more than 2 characters for state codes.
- Now checks if existing
Frontend Improvements
- Updated
endereco.js
to improve handling of subdivision (state/region) codes:- More robust error handling and fallback logic.
- Better support for countries with varying subdivision code formats.
Backend Enhancements
- Modified
IncludeConfigWidget.php
to provide more comprehensive state data to the frontend:- Now includes country code information alongside state details (necessary for correct mapping).
- Restructured state mapping arrays for improved lookup efficiency.
Bug Fixes
- Corrected potential issues with uppercase/lowercase handling in state code comparisons.
- Fixed edge cases where empty or null values could cause unexpected behavior.
- Connected subdivision code in shipping address to AMS
Other Changes
- Minor code cleanup and performance optimizations throughout.
Upgrading
When upgrading to this version, please ensure that MOJOISO31662
column in oxstates
contains the full and correct ISO 3166-2 code of the region. You can find a full list of ISO 3166-2 codes for a specific country at https://www.iso.org/ We are also using their database for Endereco API.