Open alessioacella opened 3 months ago
Update: I realise something else might be at play here. I will dig into this one and get back to you.
@olivermrbl, thank you for your support. I want to confirm that the issue still occurs even when "items.tax_lines"
is added to the relations array.
Here are two more Sentry screenshots of the cart error happening in our production environment. Our current front-end workaround, which applies to creating, updating, deleting, and editing cart items following a 500 error, is far from a long-term solution. Additionally, we have implemented a "pre-check" to validate discounts, gift vouchers, price lists, etc. before transactions.
Our environment is particularly challenging due to the high volume of daily product changes, including new additions, drafts, and deletions. This dynamism highlights the need for a backend that can automatically maintain and adjust cart contents to ensure uninterrupted functionality.
I welcome any suggestions or insights on developing a more robust solution. I am ready to help in any way to deal with this problem more effectively.
@olivermrbl Any news on this?
Hi @olivermrbl, following up on this. Any news? If there's anything I can do to help, please let me know.
@olivermrbl Did you have any chance to take a look at this?
If I am not mistaken, what you are trying to do is an unexpected behavior. Since the cart itself does not contain any 'product' only an array of 'line_item', what I think is happening is that when you delete the product from the admin the line item does not get deleted, but is still pointing to the product, which at this point does not exist, hence it corrupts anything related.
Bug report
The error message indicates a failure due to tax lines needing to be joined to calculate taxes, pointing to a deeper issue within the cart total calculation logic, particularly when handling deleted products with applied discounts.
System information
Medusa version (including plugins): 1.20.3 Node.js version: v18.19.1 Database: postgresql Operating system: ubuntu-server
Steps to reproduce the behavior
Expected behavior
Deleted product should be deleted from an uncompleted cart, totals should automatically works in any cases without throwing exceptions.
Screenshots
Code snippets