I want to sort products by popularity and discount(high to low).

How can I achieve?

  • Which term you refer when you say popularity? Is it most viewed, bestseller or sort accouding to custom order ? Jun 27, 2022 at 15:17

2 Answers 2


You can use native table for select popularity and discount:

report_viewed_product_index - products popularity (SUM(index_id) GROUP BY product_id)

catalog_product_index_price - discount = final_price - price


You can check this module and use funtional part accordingly. https://github.com/manishjoy/magento2-catalog-sortby

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.