Cart Transform API Merge Operation -- Adding new attributes to cartLines during MergeOperation?

Hey guys, I have a quick question on this note in the changelog:

I can successfully pass in new attributes to the merged bundle, but how can I target individual components within the bundle for new line item attributes?

Say I want to add some new properties to one of the existing child components? Is it possible? cartLines seems to not accept attributes, as she just wants id and quantity

Is there any way to preserve existing line item attributes and also add some custom ones to children during the merge operation?

operations.push({
        merge: {
          parentVariantId: parentLine.merchandise.id,
          cartLines: [
            {
              cartLineId: parentLine.id,
              quantity: parentLine.quantity,
            },
            ...relatedChildLines.map((childLine) => ({
              cartLineId: childLine.id,
              quantity: childLine.quantity,
            })),
          ],
          attributes: [{
            key: "newAttribute",
            value: "newValue!",
          }]
        }
      });

Hi Grizzlypoppy,

I’ve connected with the product team on this, and they’ve advised that you can set attributes on ExpandedItem.

Hope this helps!

1 Like

Is this available on MergeOperation? Or do we have to use Expand?

Thanks again @Liam for your response. Since this is a Merge Operation – do you happen to know if ExpandedItem will still be accessible in the MergeOperation?

Any insight here appreciated!! TIA