Hello Magento Friends,

How are you all? Today I am here to demonstrate How to Get Region Code by Region ID in Magento 2. By chance, you missed out on our previous blog, How to Create QR Code of invoice ID and add it to Magento 2 invoice PDF.

Introduction:

In today’s world, it is possible to deliver products to any corner. Magento provides the functionality to run a multinational functioning store. At the time of building delivery and payment related extensions or customization, there is a need for region details in Magento 2. You can get Region Code by Region ID in Magento 2.

Here we are getting region code with the help of the order Increment Id method.

Steps to Get Region Code by Region ID in Magento 2:

Step 1: Go to the below path

app\code\Vendor\Extension\Helper\Data.php

And add the code as shown below.

The result of this we will get in an array format as shown below:

This way you will get the state code, state name, and use it wherever required.

Conclusion:

Therefore, this way you can Get Region Code by Region ID in Magento 2. If you have any trouble with the execution of the above steps, mention it in the comment part. Make sure to share the article amongst your Magento friends and keep in touch with us.

Happy Coding

[Total: 3   Average: 5/5]