Since upgrading to Magento 2.4x and having to use ElasticSearch as default, I am unable to find a way to sort category products by newest (created_at). I have tried enabling used_in_sort_by for created_at but it does not order products corretly. I am using the following to sort products -

                case 'new_arrivals':
                ->order('e.entity_id '. $this->getCurrentDirection());

I can get price and name sorting to work fine but sort by created_at does not. I've also tried sort by entity_id which does not work also.

1 Answer 1


Sometimes magento has strange behavior with some types. Like one time I had a filter not displaying in front cause his type was text instead of varchar or the opposite can't remember.

Learning that ordering by date isn't working wouldn't surprise me anymore from that framework^^

So you can still hack it by doing the sort by yourself I guess. Iterate on your collection and sort it using the date like that.

But you shoudl also show us what you tried to order your list cause ordering by date seems to be something done a lot, you might proceed the wrong way.

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .