0

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?

2
  • 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

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

echo "<pre>";
print_r($orderCollection->getData());
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.