Magento 2.0 Bug in Core Sales Module

Magento 2.0 Bug in Core Sales Module


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.

Arijit De

Arijit is a Magento Developer. He takes care of Magento Modifications at every level. He also works closely with his clients on Magento projects of any size and difficulty. Apart from this, he is responsible for creating Magento Extensions. He likes to use his skill and knowledge to change the technical experience of customers by creating Interactive Multi-Language websites.

Our integrations are dynamic in nature. The mentioned offerings are the cumulative possibilities of the platform (actual scenarios are specifically organization/business-dependent). For any disparity, please refer to the latest version of the integration brochures.