0

In My order tab in customer account show last order first
i want there first placed order first.

1
  • Click on order id column name. It will show you list from first order
    – Ravi Soni
    Jul 9, 2019 at 6:53

1 Answer 1

1

override function Magento\Sales\Block\Order\History::getOrders() and change created date to asc from desc

public function getOrders()
    {
        if (!($customerId = $this->_customerSession->getCustomerId())) {
            return false;
        }
        if (!$this->orders) {
            $this->orders = $this->getOrderCollectionFactory()->create($customerId)->addFieldToSelect(
                '*'
            )->addFieldToFilter(
                'status',
                ['in' => $this->_orderConfig->getVisibleOnFrontStatuses()]
            )->setOrder(
                'created_at',
                'asc'
            );
        }
        return $this->orders;
    }

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.