Get product attribute’s option id from label and get option label from id in magento 2.

In Magento 2 We can get product attributes option id from the label and get option label by option id by below way,
Lets we have taken a color attribute and we have to find color label based on color option id.

Let’s assume We have option id 50 and its value is Blue from Attribute code Color.

Call in a template file,

We can get option id from option label and get option label from option id in Magento 2 by above tricks.

Leave a Reply

Your email address will not be published. Required fields are marked *