Skip to content

GraphQL addWishlistItemsToCart Fails to Update Quantity for Existing Cart Items When One Wishlist Item Is Invalid (Magento 2.4.7-p3) #39820

Open
@lintots

Description

@lintots

Preconditions and environment

  • Magento version: 2.4.7-p3
  • GraphQL enabled
  • Default Magento Luma theme or similar
  • Wishlist and Cart modules enabled

Steps to reproduce

  1. Create a simple product and a configurable product (with required options).
  2. Add the simple product to the cart with quantity = 1.
  3. Add the configurable product to the wishlist, but do not select options.
  4. Add the same simple product to the wishlist.
  5. Use the GraphQL mutation addWishlistItemsToCart to try to add all wishlist items to the cart:
    mutation {
    addWishlistItemsToCart(
    wishlistId: "wishlistid"
    wishlistItemIds: [])
    {
    status
    add_wishlist_items_to_cart_user_errors {
    code
    message
    }
    wishlist {
    id
    items_v2 {
    items {
    id
    product {
    uid
    sku
    name
    }
    }
    }
    }
    }
    }

Expected result

  • The mutation should:
    - Add the simple product to the cart again, updating its quantity from 1 → 2.
    - Skip the invalid configurable product and include its error in the add_wishlist_items_to_cart_user_errors array.
    - Return a success status and updated wishlist info.

Actual result

  • The mutation fails early due to the invalid configurable product (missing required options).
  • The simple product's quantity is not updated in the cart.
  • The process halts on the first failure instead of continuing with other valid wishlist items.

Additional information

  • The issue occurs only if a configurable product with missing required options appears before valid items in the wishlist.
  • For example:
    1. A simple product (e.g., simple-sku) is already in the cart with quantity 1.
    2. The same simple product is also added to the wishlist.
    3. A configurable product (with required options not selected) is added to the wishlist before the simple product.
    4. When calling addWishlistItemsToCart, the configurable product causes an exception (REQUIRED_OPTIONS_MISSING), which halts the mutation execution.
    5. As a result, the simple product below it in the wishlist does not get processed — its quantity in the cart is not updated.
  • If the invalid configurable product is placed after the valid product in the wishlist item list, then the valid product gets processed first and is updated in the cart, but the configurable product still throws an error (as expected). So the order matters.

Release note

No response

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

Assignees

No one assigned

    Labels

    Area: Cart & CheckoutComponent: WishlistGraphQlIssue: 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.Reported on 2.4.7-p3Indicates 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

    Ready for Development

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions