Skip to content

GraphQL product visibility isn't handled correctly for search results #36591

@paales

Description

@paales

Preconditions and environment

  • Magento 2.4.5

Steps to reproduce

We've got a product API testproduct 1 (sku: API-TEST-1) which has set Visbility: Catalog and isn't assigned to any category. This effectively means that the product isn't visible anywhere by navigating, but the product page still works.

Run query online

# It shows the the product, while it shouldn't query IncorrectlyReturnsAPITEST1 { one: products(search: "") { items { name sku } } } # For the above query this is a workaround by using a space for the search field query CorrectlyDoesNotReturnAPITEST1 { two: products(search: " ") { items { name sku } } } # Because there is a search term given, it correctly uses visibility search and thus # does not return the product query CorrectlyDoesNotReturnAPITEST2 { three: products(search: "API") { items { name sku } } } # Because there is a search term given, it should always use Visbility: Search # but it seems to be filtering on Visbility: Product query IncorrectlyReturnsAPITEST2 { four: products(search: "API", filter: {price: {from: "1"}}) { items { name sku } } }

Expected result

 "data": { "one": { "items": [ { "name": "DrayTek Vigor 2927F", "sku": "V2927F" }, { "name": "DrayTek Web Content Filter B", "sku": "DrayTek Web Content Filter B" }, { "name": "ZyXEL ZyWALL VPN100 Firewall", "sku": "VPN100-EU0101F" } ] } },
 "data": { "four": { "items": [] } },

Actual result

 "data": { "one": { "items": [ { "name": "DrayTek Vigor 2927F", "sku": "V2927F" }, { "name": "DrayTek Web Content Filter B", "sku": "DrayTek Web Content Filter B" }, { "name": "ZyXEL ZyWALL VPN100 Firewall", "sku": "VPN100-EU0101F" }, { "name": "API testproduct 1", "sku": "API-TEST-1" } ] } },
 "data": { "four": { "items": [ { "name": "API testproduct 1", "sku": "API-TEST-1" } ] } },

Additional information

So it seems that it can use the Visbility: Search, but when any filter is provided it switches to the Visibility: Catalog

Release note

Correctly set the visibility filer when providing a search parameter

Triage and priority

  • 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

Labels

Area: ProductComponent: GraphQLGraphQLIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: doneReported on 2.4.5Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions