We recently got the requirement to change the default sorting direction of category pages to descending. If you have the same task to do then here is the solution.
- within your theme create new directory path Magento_Catalog/layout
- create a file with name catalog_category_view.xml
- paste the content below in this file and clear the Magento cache
<?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="category.products.list"> <action method="setDefaultDirection"> <argument name="dir" xsi:type="string">desc</argument> </action> </referenceBlock> </body> </page>