• Skip to primary navigation
  • Skip to content
  • Skip to footer

RedChamps

RedChamps Blog

Main navigation

  • Magento 1 Extensions
  • Magento 2 Extensions
  • Visit Store

Magento 2 category pages change default sorting direction

Programming · September 15, 2017

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>
  • Facebook
  • Twitter
  • Google+

Filed Under: Programming

Rav

Founder and Magento Certified Developer at RedChamps

Footer

Follow Us ON

  • Facebook
  • Twitter
Copyright © 2025 • Powered by RedChamps