We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    For this we need product object. Either you can use MagentoCatalogModelResourceModelProduct class or you can use product model class MagentoCatalogModelProduct

    You have to add any one class in your construct like below:

    public function __construct(
        MagentoCatalogModelProduct $product,
        array $data = []
    ) {
        $this->product = $product;
    }

    Now you can use product object to get attribute label.

    Get label considering current store view use this :

    $this->product->getResource()->getAttribute($code)->getStoreLabel();

    &

    Get default label use this :

    $this->product->getResource()->getAttribute($code)->getFrontendLabel();

     

    field_5bfb909c5ccae

      Get a Free Quote