Cart transform - multiple merge operations with same parent variant #404
Description
Describe the bug
We have a problem when multiple numbers of the same bundle exist in the cart.
After navigating to checkout, the price update modal is displayed and child components are added back to the cart.
Example function output:
{ "operations": [ { "merge": { "cartLines": [ { "cartLineId": "gid://shopify/CartLine/9dff30c8-b084-4e53-ab6c-38b1d0ee5d0a", "quantity": 1 }, { "cartLineId": "gid://shopify/CartLine/96dbc3d2-73b6-4544-bf27-3c434f74d43f", "quantity": 1 } ], "parentVariantId": "gid://shopify/ProductVariant/47599165669668", "price": { "percentageDecrease": { "value": 25 } }, "image": null, "title": "Bundle 34" } }, { "merge": { "cartLines": [ { "cartLineId": "gid://shopify/CartLine/9dff30c8-b084-4e53-ab6c-38b1d0ee5d0a", "quantity": 1 }, { "cartLineId": "gid://shopify/CartLine/96dbc3d2-73b6-4544-bf27-3c434f74d43f", "quantity": 1 } ], "parentVariantId": "gid://shopify/ProductVariant/47599165669668", "price": { "percentageDecrease": { "value": 25 } }, "image": null, "title": "Bundle 34" } } ] }
The problem also exists when we assign different titles to operations.
Example function output:
{ "operations": [ { "merge": { "cartLines": [ { "cartLineId": "gid://shopify/CartLine/075d4d14-4bf2-4389-b4e4-f7886cd7bb2e", "quantity": 1 }, { "cartLineId": "gid://shopify/CartLine/2a56590c-acd7-4595-adfe-a80b11994646", "quantity": 1 } ], "parentVariantId": "gid://shopify/ProductVariant/47599165669668", "price": { "percentageDecrease": { "value": 25 } }, "image": null, "title": "1" } }, { "merge": { "cartLines": [ { "cartLineId": "gid://shopify/CartLine/075d4d14-4bf2-4389-b4e4-f7886cd7bb2e", "quantity": 1 }, { "cartLineId": "gid://shopify/CartLine/2a56590c-acd7-4595-adfe-a80b11994646", "quantity": 1 } ], "parentVariantId": "gid://shopify/ProductVariant/47599165669668", "price": { "percentageDecrease": { "value": 25 } }, "image": null, "title": "2" } }, { "merge": { "cartLines": [ { "cartLineId": "gid://shopify/CartLine/075d4d14-4bf2-4389-b4e4-f7886cd7bb2e", "quantity": 1 }, { "cartLineId": "gid://shopify/CartLine/2a56590c-acd7-4595-adfe-a80b11994646", "quantity": 1 } ], "parentVariantId": "gid://shopify/ProductVariant/47599165669668", "price": { "percentageDecrease": { "value": 25 } }, "image": null, "title": "3" } }, { "merge": { "cartLines": [ { "cartLineId": "gid://shopify/CartLine/075d4d14-4bf2-4389-b4e4-f7886cd7bb2e", "quantity": 1 }, { "cartLineId": "gid://shopify/CartLine/2a56590c-acd7-4595-adfe-a80b11994646", "quantity": 1 } ], "parentVariantId": "gid://shopify/ProductVariant/47599165669668", "price": { "percentageDecrease": { "value": 25 } }, "image": null, "title": "4" } } ] }
Expected behavior
We needed to add multiple bundles to the cart that would work properly at checkout.
Additional context
We are only using merge functionality and have not implemented expand operations.
Everything works fine if there is only one bundle on the cart.