Magento 2.0 Bug in Core Sales Module

AM
Anita M.
Distribution Center Manager
★★★★★★★★★★
4.5/5 · 9/21/2026

Time-Saving Integration with Excellent Support

"I like that APPSeCONNECT saves us a lot of time by automating the import of sales orders from Shopify into SAP Business One. It helps in updating business partner contact information, which is great because before we had to hand-type the orders, but now it's all imported smoothly."

Read more APPSeCONNECT Reviews
Atul Gupta1 min read

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.

ISSUE:-

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.



SOLUTION:-

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

Follow the below path to make the changes:-

[magento_root_folder]
Vendor
   module-sales
     Model
      Order
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();

 } 

EXPLANATION FOR REMOVAL :

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.

AM
Anita M.
Distribution Center Manager
★★★★★★★★★★
4.5/5 · 9/21/2026

Time-Saving Integration with Excellent Support

"I like that APPSeCONNECT saves us a lot of time by automating the import of sales orders from Shopify into SAP Business One. It helps in updating business partner contact information, which is great because before we had to hand-type the orders, but now it's all imported smoothly."

Read more APPSeCONNECT Reviews

Request for a personalized demo

Related Resources