cancel
Showing results for 
Search instead for 
Did you mean: 

Abbrevations for the state dropdown in Magento 2

SOLVED
   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Abbrevations for the state dropdown in Magento 2

Hi,

I am using Magento 2.1.4 and i need to display the region code instead of fullname in the State/Province dropdown in the cart.
For Example:
California --> should be CA
Alaska
-> AK

Please suggest any solution...

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Abbrevations for the state dropdown in Magento 2

Hi,

Thanks for your response,

We have override the Collection.php model file in app/code by our own...

I am closing the topic here..

View solution in original post

4 REPLIES 4

Re: Abbrevations for the state dropdown in Magento 2

@soho_rize 

 

Best and the easiest way is to use the Magento Translate feature and update the CSV with the desired Abbreviations. 

Magento Certified Solution Specialist | Lead Magento developer
If this response was helpful to you, consider giving kudos to this post

Re: Abbrevations for the state dropdown in Magento 2

@soho_rize

You can find more details about Magento internationalization here: http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/translations/xlate.html 

Magento Certified Solution Specialist | Lead Magento developer
If this response was helpful to you, consider giving kudos to this post

Re: Abbrevations for the state dropdown in Magento 2

Hi ShoaibRehman89,

We do not need to change the each and every state for the required countries manually by csv translation....

We have tried changing the following file

From

$option['label'] = $item->getName();

To

$option['label'] = $item->getCode();

 
in

public function toOptionArray()


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


And is working fine, but the thing is we need to override the same from our theme...as it is core file modification.

Please suggest...

Re: Abbrevations for the state dropdown in Magento 2

Hi,

Thanks for your response,

We have override the Collection.php model file in app/code by our own...

I am closing the topic here..