0

How to load new product collection in Magento 2 something like

$collection->addAttributeToFilter('parent_id', null);

I want all simple product which is not associate with configurable which mean it has no parent.

Or any other approach ?

1 Answer 1

0

I have added following join to the product collection query

 $collection->getSelect()->joinLeft(
        'catalog_product_super_link',
        'e.entity_id = catalog_product_super_link.product_id'
    )->where ("catalog_product_super_link.product_id IS NULL");

and got the desired collection.

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.