I want to get the value of a custom dropdown attribute however its proving more difficult that i anticipated. I have tried:

return $this->_customerSession->getCustomer()->getCp_permissions(); 
return $this->_customerSession->getCustomer()->getCp_permissions()->getValue();
return $this->_customerSession->getCustomer()->getCp_permissions()->getLabel();

No luck any ideas?


Ok typical i solved this instantly after posting:

$customer = $this->_customerSession->getCustomer();
return $customer->getResource()->getAttribute('cp_permissions')->getFrontend()->getValue($customer);

This will pull the label not the ID of the attributes value.

| improve this answer | |

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.