magento 2 load product attribute code example
Example 1: magento load product by id
$productId = 20;
$product = Mage::getModel('catalog/product')->load($productId);
Example 2: Magento2: How to load product by id
productRepository = $productRepository;
}
public function getProduct()
{
$productId=1;
return $product = $this->productRepository->getById($productId);
}
}