How can I get recent 100 orders in magento 2.Currently I am getting orders but those are coming from starting onwords.I want recently placed 100 orders only. Can you help me on this ? I am getting orders collection using this

  • Add your code in question – Prashant Valanda Nov 30 '16 at 11:00
  • Do I need to add complete code ? – shankar boss Nov 30 '16 at 11:06

you can get recent order with below code..

protected $_orderCollectionFactory;

public function __construct(
            \Magento\Sales\Model\ResourceModel\Order\CollectionFactory $orderCollectionFactory,
        ) {
    $this->_orderCollectionFactory = $orderCollectionFactory;


public function getOrders()

        $ordercollection =$this->_orderCollectionFactory->create()->addFieldToSelect(array('*'));

    return $ordercollection;

Use below code:

$collection = $this->_orderCollectionFactory->create();

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.