@ryan.murray
To get the category name in Magento 2, you can use the following steps:
Alternatively, you can also use the following code snippet to get the category name in Magento 2:
1 2 3 4 5 6 7 8 9 |
<?php $objectManager = MagentoFrameworkAppObjectManager::getInstance(); $category = $objectManager->create('MagentoCatalogModelCategory')->load($categoryId); $categoryName = $category->getName(); ?> |
In this code snippet, $categoryId
is the ID of the category that you want to get the name for. You can use this code snippet in your custom module or block class to get the category name.
I hope this helps! Let me know if you have any questions.