Function does not support Multiple Cart Transform Operations

Function does not support Multiple Cart Transform Operations

Mirza4545
Shopify Partner
2 0 0

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?


Mirza
Replies 0 (0)