Function does not support Multiple Cart Transform Operations

Topic summary

  • Main issue: In a Shopify cart transform function, attempting to apply both an expand and an update to the same cart line within one execution. When both are included, only the expand takes effect at checkout, while each operation works correctly when run alone.

  • Context: No errors appear in logs. The code iterates over cart lines and builds an operations array containing two entries per line—{ expand: … } and { update: … }—then returns them if present.

  • Key question: Does Shopify Functions support multiple cart transform operations (expand and update) on the same cart line in a single run, and is there an ordering or API limitation that prevents the update from applying after expand?

  • Status: No solution or workaround provided yet; the issue remains unresolved. The included code snippet is central to understanding and reproducing the behavior.

Summarized with AI on December 22. AI used: gpt-5.

I’m trying to expand and update the same CartLine using the same Function but its not working, when both active only expand works in the checkout, but seperatly both are working fine and no errors in the log.

export function run(input: InputQuery): FunctionResult {
const operations = input.cart.lines.reduce(
(acc: any, cartLine: { id: any; merchandise: any }) => {
const expandOperation = optionallyBuildExpandOperation(cartLine);
const updateOperation = createUpdateOperation(cartLine);

if (updateOperation) {
return [
…acc,
{ expand: expandOperation },
{ update: updateOperation },
];
} else {
return acc;
}
},
as CartOperation
);

return operations.length > 0 ? { operations } : NO_CHANGES;
}

anyone have a solution for this?