As we all know Magento 2.0 is out since November last year. Though this new version has some amazing enhancements over its previous 1.9 series it has still has some bugs. Magento team is working on fixing these issues as well, but some of our customers have already upgraded to Magento 2.0, so we had to provide a fix immediately to prevent any integration problem.


When we are pulling sales order data using REST Api,in the address section, we are getting the value of region_code as region name which should not be the case but it should have the value of region_code itself.


For this we need to change the core files to get the things correct.

Follow the below path to make the changes:-

Open Address.php file and comment out line no 125,126 and 127
This particular code in the function public function getRegionCode()

if (is_string($this->getRegion())) {

return $this->getRegion();



Whenever it gets the region name, it returns the value from there only. As a result, we get the region name as the value of region_code. So on removing this part it will not trigger getRegion() function and as a result, we will not get the region name in region_code.