2

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

1 Answer 1

3

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 and acknowledge you have read our privacy policy.

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