In Magento 2, we can enable template path hints in the following ways,
- Enabling path hints via admin configuration.
- Enabling path hints via the command line interface.
Enabling Template Path Hints via Admin Configuration:
Follow the below steps on your Magento 2 admin panel to enable template path hints for both storefront and admin panel,
Step 1: Login to your Magento 2 admin panel.
Step 2: Go to Store > Configuration > Advanced > Developer. (Note: If your Magento 2 store is in production mode, the Developer link will not be shown on the admin panel).
Step 3: Now expand the Debug section, then you will be found the following options,
- Enabled Template Path Hints for Storefront: Select Yes from the dropdown to enable template path hints for the frontend.
- Enabled Template Path Hints for Admin: Select Yes from the dropdown to enable template path hints for admin panel.
- Add Block Class Type to Hints: Select Yes to add the block class.
Step 4: In this page, you can be also found one more option Allowed IPs (comma separated) under the Developer Client Restrictions section. Which helps you to restrict the template path hints based on the IP address. If this field is empty, the template path hints will be shown for everyone. By configuring your IP address in this field, you can enable the path hints on your computer alone, and you will not interfere with customers who are shopping in the store.
Step 5: Finally, click Save Config button to save the configuration.
Enabling Template Path Hints via CLI:
To enable/disable template path hints through command line inteface, run the following SSH command in your Magento 2 installed root directory.
Here is the command to enable template path hints for your Magento 2 store front,
php bin/magento dev:template-hints:enable
Here is the command to disable template path hints for your Magento 2 store front,
Php bin/magento dev:template-hints:disable
Note: There is no option to enable or disable template path hints for Admin panel using CLI command.
Hope this helps.