`/cart/change.js` - Inconsistent responses when cart transforms and product discounts are combined

When 3 products are added to the cart, then a Cart Transform function merges them into one and lastly a Product Discount function applies a percentage discount (I have not tried any other discount type) on 2 of those 3 products, everything works correctly and the /cart.js returns the correct payload with the line item having the has_components flag to true, as expected.

The odd behaviour happens when we then send a /cart/change.js request for that line item to increase its quantity, where two things can happen that depend on the payload of the request:

  • If we include the existing properties of the item in the payload like this:
    {
      "quantity": 2,
      "id": "123123123123:1c9d2b7bad3e289b04cca549c9d6b061",
      "properties": {
        "bundle": "Amazing bundle name"
      }
    }
    
    Then we get back a response where the items property is an array with the 3 separate products instead of one merged line item with has_components: true.
  • If we DO NOT include the existing properties of the item in the payload like this:
    {
     "quantity": 2,
     "id": "123123123123:1c9d2b7bad3e289b04cca549c9d6b061"
    }
    
    Then we get back that one line merged line item as expected, but it does not have the has_components: true flag.

In both cases, if we refresh the page the /cart.js endpoint then returns only the expected merged line item with the discount with the correct has_components: true flag.

Is this expected somehow or is it a bug?