Work with HTML and JS in Magento 2

During development in Magento 2, we face many issues related to HTML or JS. Sometimes js and HTML changes are not reflected. I often see that many developer run all the commands after doing changes in HTML or JS files. To reflect Html or js changes you don't need to run any command. You even…

Continue Reading Work with HTML and JS in Magento 2

How to add form key in Magento 2?

In this article, I will show you how you can use form key in your form in phtml file. In Magento, form key is used for preventing Cross-Site Request Forgery. Learn more about cross-site forgery You can use directly getBlockHtml('formkey') to get form key with a hidden field in phtml files like echo $block->getBlockHtml('formkey'); OutPut:…

Continue Reading How to add form key in Magento 2?

When you should run which commands in Magento 2?

I often see that many new Magento developer run setup upgrade command every time when they changed something from js or HTML. In this article, I will discuss about which changes need which commands to reflect changes on the frontend or backend of Magento 2. 1) php bin/magento setup:upgrade Short Form: php bin/magento set:up You…

Continue Reading When you should run which commands in Magento 2?

How to print logs in Magento 2?

Logs in Magento 2 consist of system information records for the analysis in the future. One of the most common examples of such events is the error log. Developers know the pain of errors and the process to deliver a working solution. Debugging can be made easier for them by custom logs. It helps to…

Continue Reading How to print logs in Magento 2?