Skip to content

[GraphQl] Categories from root categories of other websites are returned. #34570

Closed
@Hexmage

Description

@Hexmage

Preconditions (*)

  1. Magento 2.4.2-p1
  2. Two Websites with different root categories

Steps to reproduce (*)

  1. Create a product
  2. Assign the product to both websites
  3. Add the product to a subcategory of both root categories.
  4. Request the product through GraphQl using the Store header of the first website.
query productDetail {
    productDetail: products(filter: {url_key: {eq: "24-MB01"}}) {
        items {
            sku
            __typename
            categories {
                name
                path
                url_key
            }
        }
    }
}

Expected result (*)

Only returns categories that are in the website's root category (in this example 2).

{
    "data": {
        "productDetail": {
            "items": [
                {
                    "sku": "24-MB01",
                    "__typename": "SimpleProduct",
                    "categories": [
                        {
                            "name": "Gear",
                            "path": "1/2/3",
                            "url_key": "gear"
                        },
                        {
                            "name": "Bags",
                            "path": "1/2/3/4",
                            "url_key": "bags"
                        }
                    ]
                }
            ]
        }
    }
}

Actual result (*)

Returns categories in every root category (in this case 2 and 41).

{
    "data": {
        "productDetail": {
            "items": [
                {
                    "sku": "24-MB01",
                    "__typename": "SimpleProduct",
                    "categories": [
                        {
                            "name": "Gear",
                            "path": "1/2/3",
                            "url_key": "gear"
                        },
                        {
                            "name": "Bags",
                            "path": "1/2/3/4",
                            "url_key": "bags"
                        },
                        {
                            "name": "Not Default Category",
                            "path": "1/41",
                            "url_key": "not-default-category"
                        }
                    ]
                }
            ]
        }
    }
}

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • 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

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.2-p1Indicates 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