How to change Magento 2 Sub Category Page Title? I want to show parent category title when visiting sub-category.
Magento – Display Parent Category Title on Sub Category Page Title
categorymagento2
Related Topic
- Magento – make 2 parent categories and attach to them same sub category
- Magento 1.9 Category – How to Get All Parent Categories Using Category ID
- Magento – Displaying all sub categories of parent category on sub category page
- Magento – Magento: Category Name vs Page Title Name
- Magento 2 – Display Sub Category of Parent
- Magento – How to change page title of a category programmatically
Best Answer
You can try the below code.
Step1 - Creating registration.php file in the following path - app/code/Training/Changecattitle.
Step2 - Creating module.xml file in the following path - app/code/Training/Changecattitle/etc.
Step3 - Creating di.xml file to overwrite \Magento\Catalog\Block\Category\View in the following path - app/code/Training/Changecattitle/etc.
Step4 - Creating View.php file in the following path - app/code/Training/Changecattitle/Block/Category.
Run setup upgrade script.
Clear Cache.
Give folder permission 0777 to var folder.
you can download full module from github link https://github.com/jothibasuj/Mage2-Custom-Modules/tree/master/Mage2-Custom-Modules/Training/Changecattitle