Given a Magento\Catalog\Api\Data\ProductInterface $product
and string $attributeCode
of an arbitrary attribute, I can access the attribute value, using:
$product->getCustomAttribute($attributeCode)->getValue();
This is the Service Contract variant of $product->getData($attributeCode)
Now I'm looking for an equivalent to $product->getAttributeText($attributeCode)
because the attribute might be a "select" or "multiselect" type.
Is it possible, using only Service Contracts? If I load the attribute, using Magento\Catalog\Api\ProductAttributeRepositoryInterface
, I could use $attribute->getFrontend()->getValue()
, but this is again using implementation details that are not part of the Service Contract API.