Fetch Attribute Id from the attribute code in Magento 2 by using AttributeRepository Interface Class.
You need the Entity type value and the attribute code.
Just instantiate the Magento\Eav\Api\AttributeRepositoryInterface class to retrieve the id value. Continue reading “How to Get Attribute Id by attribute code Magento 2?”