How are you all doing? Welcome all in the new article of How-To series and today we will learn How to check if Magento 2 is running in production mode. Previously, I have illustrated on How to Add Custom Block in Cart Summary Before Subtotal in Magento 2? with appropriate codes required to perform.


Basically, the Magento 2 production mode is the most effective mode for all the Magento 2 websites in result the website is fully optimized and it operates smoothly and boosts the best customer experience. Mainly the use of production mode is very safe and secure with reason to it is if any inappropriate user tries to access the pub/static folder and actively performs changes to it then that will just make changes in the duplicate versions and that files will be overwritten during the next static deploy.

Steps of Coding 

There are 2 ways to check if Magento 2 is running in production mode.

Method 1:  (Not Recommended Method)

Note:  According to Magento Standard, Using Object Manager is not Recommended, We shared the way just for the knowledge purpose.

Method 2: Magento coding standard wise

You can go for any method given above and implement for checking if Magento 2 is running in production mode. After the implementation, you will be successfully able to know the mode of your Magento 2 Store.


At last but not least if you find the article helpful do comment down your valuable reviews in the comment section below and for any queries, you get in implementing the above article then kindly contact our Support Team. Also, comment down any problem you face in Magento 2. We will create the best solution article for you and don’t forget to share with your Magento friends and help them in solving the queries. 

Happy Coding! 

Click to rate this post!
[Total: 0 Average: 0]