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

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

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

Your Answer

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

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