Skip to content

Sorting by position on product search via REST API does not work #31591

Closed
@mack4hack

Description

@mack4hack

Preconditions

  1. Magento 2.4-develop
  2. Magento 2.3.3
  3. Vanilla Install

Steps to reproduce

  1. Allow Anonymous Guest Access
    From : Stores -> Configuration -> Services -> Magento Web API -> Web API Security

  2. Assign position value to products
    from : Catalog -> Categories -> Select Category -> Products in Category

2021-01-08_10-42

  1. Hit this endpoint:
    GET : <domain name>/rest/V1/products/?searchCriteria[filterGroups][0][filters][0][field]= category_id&searchCriteria[filterGroups][0][filters][0][value]=3&searchCriteria[sortOrders][0][field]= position&searchCriteria[sortOrders][0][direction]=ASC&searchCriteria[pageSize]=5

Screenshot from 2021-01-08 10-44-33

Expected result ✔️

The product's list should be sorted by "position" parameter

Actual result: ✖️

The product's list is not sorted by the "position" parameter

2021-01-08_10-45

Search Criteria, as returned in the response

"search_criteria": {
    "filter_groups": [
      {
        "filters": [
          {
            "field": "category_id",
            "value": "3",
            "condition_type": "eq"
          }
        ]
      }
    ],
    "sort_orders": [
      {
        "field": "position",
        "direction": "ASC"
      }
    ],
    "page_size": 5
  }

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Component: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Component: CatalogIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: ready for confirmationPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.3.3Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S2Major restrictions or short-term circumventions are required until a fix is available.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions