Skip to content

[GraphQl] Cart error messages are faulty #34546

@Hexmage

Description

@Hexmage

Preconditions (*)

  1. Magento 2.4.2+

Steps to reproduce (*)

  1. Create a cart
  2. Add 2 products to the cart with at least 4 quantities each.
  3. Set the quantity of added products below the quantity in the cart.
  4. Retrieve cart through graphql
{
  cart(cart_id: "RQg4YPcQX1htp47j6GMpTKRshfY6SVm6") {
    items {
      id
      product {
        name
        sku
        stock_status
      }
      quantity
    }
  }
}

Expected result (*)

  1. A error message which tells me which item in the cart causes the error. So that we can give correct feedback to the Customer.
  2. A cart with valid values for items.
  3. An error message for each issue with the cart.

Actual result (*)

{
  "errors": [
    {
      "message": "The requested qty is not available",
      "extensions": {
        "category": "graphql-input"
      },
      "locations": [
        {
          "line": 7,
          "column": 5
        }
      ],
      "path": [
        "cart",
        "items",
        0
      ]
    }
  ],
  "data": {
    "cart": {
      "items": [
        null,
        {
          "id": "32",
          "product": {
            "name": "Strive Shoulder Pack",
            "sku": "24-MB04",
            "stock_status": "IN_STOCK"
          },
          "quantity": 3
        },
        {
          "id": "33",
          "product": {
            "name": "Joust Duffle Bag",
            "sku": "24-MB01",
            "stock_status": "IN_STOCK"
          },
          "quantity": 4
        }
      ]
    }
  }
}
  1. In the items node there is a null entry, this only shows up when there is an error. In default Venia this breaks the cart page.
  2. I assume the path node in the error node should reference the item it's affecting. It currently points to the above null value.
  3. Only the first error of the cart shows up.

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

No one assigned

    Labels

    Area: APIsIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneProject: GraphQLReported on 2.4.2Indicates 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