In this tutorial, we will see how to enable template path hints in Magento 2. By enabling "Template Path Hints", you can see exactly which file a particular area of the page is created from. This makes it easy to locate a particular .phtml file and update it to make changes in the specific content on the storefront.
Magento 2 Template Path Hints is the part of the Debug process while developing a webshop. Template Path Hints adds notation with the path to each template and displays the errors directly on the screen. This is one of the best ways to debug your store.
Template path hints can be enabled for either the storefront or the Admin. If Magento 2 template hints are not showing on storefront, then you can use any of the following two methods to fix this problem.
Make sure to Clear Magento Cache if template path hints for storefront are not working.
If you refresh your front end view (your website) you should now see Template Path Hints enabled for you and you can easily trace the .phtml files and edit it.
Connect to your store with SSH terminal, and go to the root directory of your Magento 2 store.
php bin/magento dev:template-hints:enable
php bin/magento dev:template-hints:disable
Make sure, you clear Magento 2 cache if Magento 2 template hints are not showing.
Clear Magento Cache to remove all hints from the store using the following command:
bin/magento cache:flush
That’s all about enabling template path hints in Magento 2. This is as straightforward as it seems. However, no question is a wrong question so don’t hesitate to contact us in case you have any questions related to template path hints in Magento 2.
Related Articles: