Skip to content

Instantly share code, notes, and snippets.

@bka
Created January 4, 2016 13:21
Show Gist options
  • Save bka/240e4526f8c6e5424bbb to your computer and use it in GitHub Desktop.
Save bka/240e4526f8c6e5424bbb to your computer and use it in GitHub Desktop.
Magento2 load product
$appState = $objectManager->get("Magento\Framework\App\State")
$appState->setAreaCode("frontend")
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$productFactory = $objectManager->create("\Magento\Catalog\Model\ProductFactory");
$product = $productFactory->create()
$product->load(1)
$product->getData()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment