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

  • may be It can be an indexing issue.did you reindexed or not ? – Savan Patel Apr 19 at 12:38
  • @SavanPatel I already tried that and it did not work. – Kevin S Apr 19 at 12:51
  • try below code , hope it useful – Savan Patel Apr 19 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 – Mohit Kumar Arora Apr 19 at 13:41
1

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, privacy policy and cookie policy

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