Magento 2 : Show Icons for Each Category in Mega Menu
Question
Is there a way to check If category has image? I want to show icons for each category individual in Mega Menu.
I want to dynamic add categories in mega menu. Please see attached screenshot.
Any help would be greatly appreciated!
Solution
You can check in Category page by using below code.
$_category = $block->getCurrentCategory(); // get Current Category
$_imgUrl = $_category->getImageUrl()
If $_ImgUrl is not equal to blank means category has image else not.
Thanks
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange