0

how to change the product list Date 'asc >> desc'

Now is showing asc.

I want to change is desc is default >> ?product_list_dir=desc

using Magento Version 2.2.4

thank you!

1 Answer 1

1

Navigate to or create the following file

app/design/frontend/vendor/theme/Magento_Catalog/layout/catalog_category_view.xml

Add following code

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <referenceBlock name="category.products.list">
                <action method="setDefaultDirection">
                    <argument name="dir" xsi:type="string">desc</argument>
                </action>
            </referenceBlock>
        </referenceContainer>
    </body>
</page>

Reference: Magento2: Default to sort by price descending not ascending

2
  • sorry i can't see this file. are you using 2.2.4? @DineshYadav
    – niceonelee
    May 8, 2018 at 17:58
  • you have to create this file if it doesn't exist in your theme. May 9, 2018 at 4:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.