How can I filter admin order collection and showing only pending orders in grid?

So how can I extend it in custom module? Any suggestion about that?

  • Their would be only one table for order collection, not like frontend, admin side order collection. @mahmoudismail Jun 29, 2018 at 14:29
  • @Learing_Coder how i can set filter to sale order grid collection? Jul 2, 2018 at 12:27

1 Answer 1

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$orderCollectionFactory = $objectManager->create('Magento\Sales\Model\ResourceModel\Order\CollectionFactory')->create();
$orderCollection = $orderCollectionFactory
                ->addFieldToFilter('status', array('in' => array('pending_payment')))

echo "<pre>";
echo "</pre>";

You will get all the pending order in this 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.