4

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 ?

15

Use getStoreLabel() ,instead of getFrontendLabel()

0

Just as a quick heads up for other ppl having the same problem: $_product->getResource() shouldn't be used anymore because resource models should be used directly and it's therefore deprecated.

Instead, add \Magento\Catalog\Model\ResourceModel\Product to your constructor to use it directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.