Get Dropdown Product Attribute Value in Magento 2

If you have started coding in Magento 2 then you might have come through this situation: How to retrieve dropdown attribute value for a product. Well this is pretty same as we did in Magento 1. Just use following snippet to get dropdown product attribute value:

<?php 
$attribute_code = 'availability';
echo $_product->getResource()->getAttribute($attribute_code)->getFrontend()->getValue($_product);
?>

Written by Arvind Bhardwaj

Arvind is a certified Magento 2 expert with more than 10 years of industry-wide experience.

Website: http://www.webspeaks.in/