1

I want to create a category collection which I can filter by its parent category id. How to do this?

2

Please use below code:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$category = $objectManager ->create('Magento\Catalog\Model\ResourceModel\Category\Collection');
$category->addAttributeToSelect('*')->addAttributeToFilter('parent_id',['eq'=>3]);

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.