-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Issue completing cart with Custom Line Item #9995
Comments
Any update on this? |
I've got a bit more spare time now, would it be useful if I take a look at fixing this one? Don't know if it's already being worked on? |
@matt-rolley, we'll be working on this shortly. You can expect it to be part of a release before the end of the year. |
@matt-rolley, I got something working locally. Would you be able to take a snapshot version for a spin? I'd like to get some feedback in case there are cases, I am not considering. |
@olivermrbl yeah sure, sounds great, happy to give it a try. |
@matt-rolley, great. Bear in mind this is a rough first take. You can install the following snapshot of the Medusa packages in your project:
|
Hey @matt-rolley, let me know if you get a chance to try it out. |
Hey @olivermrbl, really sorry for the delay - I'll be able to look at it today/tomorrow and get back to you asap. |
Hey @olivermrbl, yeah it looks like to be working now on payment complete, I've noticed an issue with custom line items and increasing quantity using /store/carts/cart_01JE6N4KHWKJNZ06ABN8PS50GA/line-items/cali_01JE6NYTZDS47D6B3GPXAP5ZSP I get this error: {
message: 'ProductVariant id not found: ',
name: 'Error',
stack: 'Error: ProductVariant id not found: \n' +
' at RemoteJoiner.checkIfKeysExist (/Users/matt/Work/TKStairs/tk-stairs/node_modules/@medusajs/orchestration/src/joiner/remote-joiner.ts:556:13)\n' +
' at RemoteJoiner.fetchData (/Users/matt/Work/TKStairs/tk-stairs/node_modules/@medusajs/orchestration/src/joiner/remote-joiner.ts:493:10)\n' +
' at processTicksAndRejections (node:internal/process/task_queues:105:5)\n' +
' at async RemoteJoiner.query (/Users/matt/Work/TKStairs/tk-stairs/node_modules/@medusajs/orchestration/src/joiner/remote-joiner.ts:1230:22)\n' +
' at async RemoteQuery.query (/Users/matt/Work/TKStairs/tk-stairs/node_modules/@medusajs/modules-sdk/src/remote-query/remote-query.ts:289:12)\n' +
' at async Query.query (/Users/matt/Work/TKStairs/tk-stairs/node_modules/@medusajs/modules-sdk/src/remote-query/query.ts:126:12)\n' +
' at async Object.<anonymous> (/Users/matt/Work/TKStairs/tk-stairs/node_modules/@medusajs/core-flows/src/common/steps/use-remote-query.ts:171:22)\n' +
' at async Object.invoke (/Users/matt/Work/TKStairs/tk-stairs/node_modules/@medusajs/workflows-sdk/src/utils/composer/helpers/create-step-handler.ts:72:52)\n' +
' at async DistributedTransaction.handler (/Users/matt/Work/TKStairs/tk-stairs/node_modules/@medusajs/orchestration/src/workflow/workflow-manager.ts:214:16)\n' +
' at async stepHandler (/Users/matt/Work/TKStairs/tk-stairs/node_modules/@medusajs/orchestration/src/transaction/transaction-orchestrator.ts:827:20)\n' +
'⮑ sat /Users/matt/Work/TKStairs/tk-stairs/node_modules/@medusajs/core-flows/dist/cart/workflows/update-line-item-in-cart.js: [update-line-item-in-cart -> use-remote-query (invoke)]',
__isMedusaError: true,
type: 'not_found',
code: undefined,
date: 2024-12-04T21:02:54.265Z
} I think this is related to the #9863 but I can get round that using a manual endpoint for changing item quantity. If this issue could be wrapped up in the this ticket, that'd be amazing - if not, I'm still happy this one is solved :) Thanks for the help/fix! |
Hey @olivermrbl, sorry as I've been testing it more, I'm also getting an issue if I try to add an additional item to the cart too: {
message: "Cannot read properties of undefined (reading 'find')",
name: 'TypeError',
stack: "TypeError: Cannot read properties of undefined (reading 'find')\n" +
' at /Users/matt/Work/TKStairs/tk-stairs/node_modules/@medusajs/core-flows/src/cart/workflows/refresh-cart-items.ts:78:34\n' +
} Anything I can do to help, just let me know :) |
@matt-rolley, thanks for the report. Will have a look at this over the weekend. I've been doing some clean-up today, so I'll have a fresh version ready for you soon! |
@olivermrbl does #10408 close this ticket and #9863? |
Package.json file
Node.js version
v20.11.1
Database and its version
PostgresSQL 16
Operating system name and version
Docker
Browser name
No response
What happended?
In the complete-cart workflow, the cart transforms the line items using prepareLineItemData but this requires a variant to be set.
Other times that prepareLineItemData are used, there seems to be a variant check first, then it uses a prepareCustomLineItemData instead.
There are a few places that only use prepareLineItemData without checking if a variant exists, so not sure if adding the prepareCustomLineItemData will solve a few other bugs?
Expected behavior
Actual behavior
Link to reproduction repo
TODO
The text was updated successfully, but these errors were encountered: