How can I get the product category's URL Key?
I can get the category name by $category->getName()
but it does not work if I use this $category->getURLKey()
,
$categories = $_product->getCategoryCollection()
->addAttributeToSelect('name');
foreach($categories as $category) {
$productCategoryName = $category->getName();
var_dump($category->getURLKey());
}
Return null
Any ideas?