I am using Magento 2.2.8 Enterprise Edition

I have a custom address attribute area a dropdown attribute with multiple options.

Now when I am getting value of attribute by using this code, I am getting ID


I just want to get Label of the selected area option, can anyone tell me How can I get it?


Load eavConfig via dependency Injection.

protected $eavConfig;
public function __construct(
    \Magento\Eav\Model\Config $eavConfig,
    $this->eavConfig = $eavConfig;

Than you can get the label like this.

$attribute = $this->eavConfig->getAttribute('customer_address', "attribute_code");
$optionlabel = $attribute->getSource()->getOptionText($attributeValue);
  • Thank you Arbab, I will apply this solution. Will get back to you Dec 10 '20 at 11:11
  • 1
    worked perfectly Dec 11 '20 at 6:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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