Hi everyone !
I want to sort by % Off like below image
and here is my code
I think Magento can only filter via attributes. Create an custom attribute called "discount" and activate the option sortable and calculate the % automatically if you save theproduct.
After that you can sort in the frontend with the default magento engine.
You need to rewrite magento files,1. add your new options to default magento filter.2. Add your logic to product collection file which create collection for page.