Want to display the category name for each product in new products widget and best sellers widget
I have tried this but not working
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$category = $objectManager->get('Magento\Framework\Registry')->registry('current_category');
echo $category->getname();