Magento 2 – Get Attribute Label Considering Current Store View

attributeslabelsmagento2store-view

I defined for 2 different store views 2 different attribut labels:
enter image description here

$_product->getResource()->getAttribute($_code)->getFrontendLabel();

This is how I get the attribute Label, but this retrieves only Default Label.

I need to display the attribute label, corresponding to user's current store. How can I do that ?

Best Answer

Use getStoreLabel() ,instead of getFrontendLabel()