I need to check if category exist or not by category name.
I have try this with category name test but it does not work at the same time it does not throw any error
$category = $this->_objectManager->create('Magento\Catalog\Model\Category');
$cate = $category->getCollection()->addAttributeToFilter('name','test')->getFirstItem();
if (!isset($cate)) {
echo "not exist";
} else {
echo "already exist";
}
how to deal with check if category exist or not?
Thanks