Magento – How to get attributes by attribute set ID in Magento 2

attribute-setattributesmagento2product-attribute

How can I retrieve a list of attributes and values by given attribute set ID in Magento 2?

Best Answer

You can use the Magento\Eav\Api\AttributeManagementInterface service contract class:

$attributeManagementInterface->getAttributes(\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE, $attributeSetId);