How to change the product list 'desc' direction?

Now Old product is default.

I want to change is new product position is default > ?product_list_dir=desc

using Magento Version 2.2.4

thank you!

  • plz explain properly – Ahsan Horani May 5 '18 at 15:31
  • want to change the date position : asc to desc <-- @MuhammadAhsanHorani – niceonelee May 7 '18 at 17:27

The only solution I found is this, edit the file located in:


add this line:

$this->_direction = strtolower('desc'); //choose 'asc' or 'desc'

in this position:

    public function setCollection($collection)
    $this->_collection = $collection;


    $this->_direction = strtolower('desc'); // *** THIS POSITION ***

    // we need to set pagination only if passed value integer and more that 0
    $limit = (int)$this->getLimit();
    if ($limit) {
    if ($this->getCurrentOrder()) {
        if ($this->getCurrentOrder() == 'position') {
            )->addAttributeToSort('entity_id', $this->getCurrentDirection());
        } else {
            $this->_collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
    return $this;

I hope I was helpful

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.