Skip to content

How to show abbreviations of State/Province instead of Full names in Magento 2

In Magento 2 customer account create I want to show abbreviations of State/Province instead of Full names.
So far I have changed this code but it is not working.

/vendor/magento/module-directory/Model/ResourceModel/Region/Collection.php

Inside function public function toOptionArray() chnaged $option['label'] = $item->getName(); to $option['label'] = $item->getCode();

Also changed

$propertyMap = [
            'value' => 'region_id',
            'title' => 'default_name',
            'country_id' => 'country_id',
        ];

to

$propertyMap = [
            'value' => 'region_id',
            'title' => 'code',
            'country_id' => 'country_id',
        ];

enter image description here