Skip to content

OR Condition in searchCriteria (REST API) dosn't work #16425

Open
@cappecar

Description

@cappecar

Magento 2.4-develop

Preconditions

I need to find all product in categories so I user a "searchCriteria" with a unique "filterGroups" and one "filter" foreach categories wanted call /V1/products resource (rest api).
In the old server with Magento 2.0 it works great, now we upgrade server and Magento if i search by more categories (or conditions) doesn't work.

Steps to reproduce

  1. Create some categories (two or tre)
  2. Create come products foreach category
  3. Enable a REST API token
  4. Make a call to resource "/V1/products" with a search parameter like this:
["searchCriteria"]=>
  array(1) {
    ["filterGroups"]=>
    array(1) {
      [1]=>
      array(1) {
        ["filters"]=>
        array(2) {
          [0]=>
          array(3) {
            ["field"]=>
            string(11) "category_id"
            ["value"]=>
            string(3) "{id category 1}"
          }
          [1]=>
          array(3) {
            ["field"]=>
            string(11) "category_id"
            ["value"]=>
            string(3) "{id category 2}"
          }
        }
      }
    }
  }

Expected result

This condition should be return all products in category {id category 1} OR {id category 2}

Actual result

Generally empty list of products, some time only products in the last category in query.

Thanks

Metadata

Metadata

Assignees

Labels

Area: CatalogComponent: WebapiUse with concrete module component label E.g. "Component: Webapi" + "Catalog"Event: dmcdindia1Issue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: dev in progressReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S1Affects critical data or functionality and forces users to employ a workaround.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions