magento 2 load product by id code example

Example 1: magento 2 get loaded product by id

$om = \Magento\Framework\App\ObjectManager::getInstance();
$product = $om->create('Magento\Catalog\Model\Product')->load($id);

Example 2: magento load product by id

$productId = 20;
$product = Mage::getModel('catalog/product')->load($productId);

Example 3: Magento2: How to load product by id

$product=$this->getLoadProduct(20);
echo $product->getName();

Example 4: Magento2: How to load product by id

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$product = $objectManager->create('Magento\Catalog\Model\Product')->load($product_id);

Tags:

Misc Example