I am trying to fetch product collection based on crated custom attribute that is is_home_page.

Check by below code.

echo "<pre>";
$productCollection = $objectManager->create('Magento\Catalog\Model\ResourceModel\Product\Collection');
/** Apply filters here */
$collection = $productCollection->addAttributeToSelect('*')

So, here what i need is Currently i want to display products on home page which product has attribute set to Yes.

I can able to get collection of products which has attribute Yes.

But i would like to get collection in order to last updated product.

how can i achieve this ?

2 Answers 2


This will do for you

 $productCollection->addAttributeToSort('update_at', 'DESC')

Try with

->addAttributeToSort('updated_at', 'DESC')

instead of

  • we do have feature in manual sort & automatic sort in EE how we need to fetch products by manual sort? prnt.sc/xothut please advise Commented Jan 27, 2021 at 4:48

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.