/** * @param Attribute $attribute * @param int $optionId * @return null|string * @toso: add mapping/caching */ public function getOptionText($attribute, $optionId) { $result = null; /** @var \Magento\Eav\Api\Data\AttributeOptionInterface $option */ foreach ($attribute->getOptions() as $option) { if ($option->getValue() == $optionId) { $result = $option->getLabel(); } } return $result; }