0

When entering a category, I select the sorting type product name. Sorting shows products in desc mode (z-a) how to implement default asc mode (a-z)

2 Answers 2

3

Create a file in the theme along the path app/design/frontend/Vendor/theme/Magento_Catalog/layout/catalog_category_view.xml

Add there

<?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">asc</argument>
                </action>
            </referenceBlock>
        </referenceContainer>
    </body>
</page>
0

Click on this arrow your products get sorted a-z, this button reverse the sorting, Hope it will help you

1
  • I need this functionality by default asc
    – Alice
    Aug 26, 2020 at 14:56

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.