0

I need to add Highest discount percentage sorting option in magento 2.4.2.

I have implemented with this code but it is not working with elastic-search

$collection->getSelect()->columns(['discounted_price' => '(100-(`price_index`.`final_price`*100)/`price_index`.`price`)']);            
$collection->getSelect()->order('discounted_price desc');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.