How to sort a product list widget using the price attribute in ascending or descending order?

How to sort a product list widget using the price attribute in ascending or descending order?
Add plugin code in etc/frontend/di.xml: Create plugin “ProductsListPlugin” and add below code in it getSelect()->reset(\Zend_Db_Select::ORDER); $result->addAttributeToSort('price', 'ASC'); // Or DESC for descending order return $result; } }


Copyright © 2024 Tridhya Tech Limited, Inc. All rights reserved.