1

I want to sort product for a specific category by name in ascending order but it is still sorting in descending order in the front-end.

For a category under Display Setting, I have set Default Product Listing Sort By to Product Name

<referenceContainer name="content">
  <referenceBlock name="product_list_toolbar">
          <action method="setDefaultDirection">
              <argument name="dir" xsi:type="string">asc</argument>
            </action>
  </referenceBlock>
</referenceContainer>

Here is how it looks.

enter image description here

I have checked the setting in all store view and I have the same setting.

Any help will be highly appreciated.

Thank you

4
  • may be It can be an indexing issue.did you reindexed or not ? Apr 19, 2019 at 12:38
  • @SavanPatel I already tried that and it did not work.
    – Kevin S
    Apr 19, 2019 at 12:51
  • try below code , hope it useful Apr 19, 2019 at 13:33
  • I have just tried it in my localhost without putting the code in the Design section's layout Update XML. I found it working fine. Please check nimb.ws/1J9mKv and nimb.ws/x3MHPz Apr 19, 2019 at 13:41

1 Answer 1

0

Try this code

 <referenceContainer name="content">
        <referenceBlock name="category.products.list">
            <action method="setDefaultDirection">
                <argument name="dir" xsi:type="string">asc</argument>
            </action>
        </referenceBlock>
    </referenceContainer>

It's working for my side

Your Answer

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

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