Open andrewnashed opened 3 years ago
I'm having the same issue
Getting the same issue
@andrewnashed have u got any solution for it
Please feel free to post if u get any solution
@ARNAV-GHATE this solution worked for me
function sanitizedLineItems(lineItems) { return lineItems.reduce((data, lineItem) => { const item = data; let variantData = null; if (lineItem.selected_options.length) { variantData = {
};
}
item[lineItem.id] = {
quantity: lineItem.quantity,
variants: variantData,
...data
};
return item;
}, {});
};
and then you would use the function in the orderData like so
`line_items: sanitizedLineItems(checkoutToken.live.line_items)`
@ARNAV-GHATE this solution worked for me
function sanitizedLineItems(lineItems) { return lineItems.reduce((data, lineItem) => { const item = data; let variantData = null; if (lineItem.selected_options.length) { variantData = { [lineItem.selected_options[0].group_id]: lineItem.selected_options[0].option_id, }; } item[lineItem.id] = { quantity: lineItem.quantity, variants: variantData, ...data };
return item; }, {}); };
and then you would use the function in the orderData like so
`line_items: sanitizedLineItems(checkoutToken.live.line_items)`
where we have to use this code in which component??? not able to get u?
@ARNAV-GHATE this solution worked for me function sanitizedLineItems(lineItems) { return lineItems.reduce((data, lineItem) => { const item = data; let variantData = null; if (lineItem.selected_options.length) { variantData = { [lineItem.selected_options[0].group_id]: lineItem.selected_options[0].option_id, }; } item[lineItem.id] = { quantity: lineItem.quantity, variants: variantData, ...data };
return item; }, {}); };
and then you would use the function in the orderData like so
`line_items: sanitizedLineItems(checkoutToken.live.line_items)`
where we have to use this code in which component??? not able to get u?
inside the payment form
Im getting a memory leak when it says error invalid data, anyone know why? Its in the address form
That fix above did not work for me as the customer data was not sent.
Hi guys i'm creating an e-commerce with CommerceJs and NextJS when handling payment i get this error
message: "The given data was invalid." type: "unprocessable_entity" line_items.item_7RyWOwmK5nEa2V.quantity: ["Requested quantity is not available."]
i tried to change my code like the docs but no luck