Skip to content
This repository was archived by the owner on Dec 19, 2019. It is now read-only.

Separate cart items are created instead of quantity increment #793

Closed
TomashKhamlai opened this issue Jul 29, 2019 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@TomashKhamlai
Copy link
Contributor

TomashKhamlai commented Jul 29, 2019

... and update of the last cart-items discards an update that was applied to the first cart-item. Cart-items are never joined together.

Related to #699

The cart is not updating properly: new cart items are created instead of changing quantity while adding the same product to the cart. At the same time update of the first cart-item do not trigger recalculation while update of the last one joins them back together.

Note: could be specific to customizable_options

c7d9130

Preconditions (*)

  1. Create a configurable product with a customizable option that is not required
    2019-07-29-16-02-graphql-ce loc

  2. Add this product to cart via addConfigurableProductsToCart. Specify that package is D and quantity is 1

  3. Change quantity to 2 via updateCartItems

  4. Add this product to cart via addConfigurableProductsToCart. Specify that package is D and quantity is 3 (repeat what was done in step 2 without any changes. Even quantity is updated it is still the same cartItem)

  5. Verify that your cart contains 2 cart items. Stop reproducing here if your information differs. For example:

{
  "data": {
    "updateCartItems": {
      "cart": {
        "items": [
          {
            "id": "27",
            "quantity": 1
          },
          {
            "id": "29",
            "quantity": 3
          }
        ]
      }
    }
  }
}

Steps to reproduce (*)

  1. Update the first item
mutation {
  updateCartItems(input: {
    cart_id: "X9klnJz5K840LhG22VeJPvoOnHFZ6KsZ"
    cart_items: {
      cart_item_id: 27
      quantity: 4
      
    }
  }) {
    cart {
      items {
        id
        quantity
      }
    }
  }
}

My result was:

{
  "data": {
    "updateCartItems": {
      "cart": {
        "items": [
          {
            "id": "27",
            "quantity": 4
          },
          {
            "id": "29",
            "quantity": 3
          }
        ]
      }
    }
  }
}
  1. Update last item
mutation {
  updateCartItems(input: {
    cart_id: "X9klnJz5K840LhG22VeJPvoOnHFZ6KsZ"
    cart_items: {
      cart_item_id: 29
      quantity: 4
      
    }
  }) {
    cart {
      items {
        id
        quantity
      }
    }
  }
}

Expected result (*)

  1. Predictive behavior
  2. Quantity increment for the request with the same product
  3. Changes to one item do not have an impact on another item

Actual result (*)

{
  "data": {
    "updateCartItems": {
      "cart": {
        "items": [
          {
            "id": "27",
            "quantity": 1
          },
          {
            "id": "29",
            "quantity": 4
          }
        ]
      }
    }
  }
}
@TomashKhamlai TomashKhamlai added the bug Something isn't working label Jul 29, 2019
@TomashKhamlai TomashKhamlai changed the title [Draft] Separate cart items are created instead of quantity increment Separate cart items are created instead of quantity increment Jul 29, 2019
@Rus0
Copy link
Contributor

Rus0 commented Aug 28, 2019

Duplicate of #792

@Rus0 Rus0 marked this as a duplicate of #792 Aug 28, 2019
@Rus0 Rus0 closed this as completed Aug 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants