Currently my code is
use Magento\Eav\Model\Attribute;
use Magento\Eav\Model\AttributeRepository;
use Magento\Framework\Api\SearchCriteriaBuilder;
$searchCriteria = $this->searchCriteriaBuilder->create();
/** @var Attribute[] $attributesList */
$attributesList = $this->attributeRepository
->getList('catalog_product', $searchCriteria)
->getItems();
foreach ($attributesList as $attribute) {
// For example; attribute code: sample (see below image)
print_r($attribute->getStoreLabels()) //(array) Working: getting all the labels available per store scope
foreach($attribute->getOptions() as $option){
print_r($option->getLabel()) //(string) Working but getting the admin store scope
print_r($option->getStoreLabels()) // NOT WORKING: gives only empty value;
}
}
I want to get all the labels from all store view as it can be different. Many thanks for the help!
Example of one product attribute is below: