How can I programmatically get the region_id in Magento from a 2-character state abbreviation? I'm using Magento 1.4.2 if that matters at all.

Accepted Answer

$regionModel = Mage::getModel('directory/region')->loadByCode($regionCode, $countryCode);
$regionId = $regionModel->getId();
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the community.
It is licensed under cc-wiki