Get Region Id By Region Code Magento 2 : If you need region id by region code. check the below code.
$regionCode = 'CA';
$countryCode = 'US';
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$region = $objectManager->create('Magento\Directory\Model\Region');
$regionId = $region->loadByCode($regionCode, $countryCode)->getId();
here $regionId contains the region id.
hope so it will help.
Be the first to comment.