0

Like we have Women category

1.Women
 1.1 Tops
 1.2.Bottoms

I want to display Women and 2nd level of that category.

which libraries used to get subcategory?

My requirement is : enter image description here

1

Magento2 got Second level category by collection,

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();

$categoryFactory = $objectManager->get('\Magento\Catalog\Model\ResourceModel\Category\CollectionFactory');
$categories = $categoryFactory->create();   
$categories->addAttributeToSelect('*');     
$categories->addAttributeToFilter('level' , 2); 
$secondlevelcategory = $categories->getColumnValues('entity_id');
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.