Hi friends, hope you are doing good. In today’s tutorial, I am going to share a very useful Magento code snippet to extend the Magento functionalities, please keep your close attention in this tutorial as I am going to share how to load the Magento 2 core in an external file.
Copy the below Magento code and use it in your custom PHP file to get the Magento 2 core functionality access.
* how to load the Magento 2 core in external file
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
Liked this program? Do Like & share with your friends.
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.