Discussing Shopify Functions development, deployment, and usage in Shopify apps.
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!",
}]
}
});
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
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