I am adding Custom shipping rates according to state of UAE in Table rates shipping method. But getting an error because region or state is incorrect.

anyone have idea which is correct region/state code for UAE states (Dubai, Abu Dhabi, Sharjah, Ajman, Fujairah, Ras Al-Khaimah & Umm Al Quwain)

Please check attached screenshots of Table Rate file.

enter image description here

1 Answer 1


You can check validation rules in the vendor/magento/module-offline-shipping/Model/ResourceModel/Carrier/Tablerate/CSV/RowParser.php:

 * Retrieve region id from provided row data.
 * @param array $rowData
 * @param int $rowNumber
 * @param ColumnResolver $columnResolver
 * @param int $countryId
 * @return array
 * @throws ColumnNotFoundException
 * @throws RowException
private function getRegionIds(array $rowData, $rowNumber, ColumnResolver $columnResolver, $countryId)
    $regionCode = $columnResolver->getColumnValue(ColumnResolver::COLUMN_REGION, $rowData);
    if ($countryId !== '0' && $this->locationDirectory->hasRegionId($countryId, $regionCode)) {
        $regionIds = $this->locationDirectory->getRegionIds($countryId, $regionCode);
    } elseif ($regionCode === '*' || $regionCode === '') {
        $regionIds = [0];
    } else {
        throw new RowException(
                'The "%1" region or state in row number "%2" is incorrect. '
                . 'Verify the region or state and try again.',
    return $regionIds;

By default the 2.4.4 Magento did not have predefined regions for the UAE, so you can't specify a region in the CSV (except empty string or * which means Any Region).

If you want to use regions you must add them manually in the table directory_country_region (it is pretty easy) or you could use this module (paid!) to add them through admin side.

Seems like this is a correct sql for adding the UAE regions (taken from Magento2 : How to add state options for UAE ):

INSERT INTO directory_country_region VALUES (NULL , 'AE', 'AUH','Abu Dhabir'), (NULL , 'AE', 'AJM','Ajman'), (NULL , 'AE', 'SHJ','Sharjah'), (NULL , 'AE', 'DXB','Dubai'), (NULL , 'AE', 'FUJ','Fujairah'), (NULL , 'AE', 'RAK','Ras Al Khaimah'), (NULL , 'AE', 'UAQ','Umm Al Quwain');
  • 1
    Thank You, It's working fine. Jun 6, 2022 at 16:18
  • @WajahatBashir I’m glad to help you :) Happy coding! Jun 6, 2022 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.