magento / pwa-studio

🛠Development tools to build, optimize and deploy Progressive Web Applications for Magento 2.
https://developer.adobe.com/commerce/pwa-studio/
Open Software License 3.0
1.06k stars 682 forks source link

[bug]: Deleting the cart quote_mask_id causes an add to cart error #4177

Closed simonmarcoux-valtech closed 8 months ago

simonmarcoux-valtech commented 11 months ago

Describe the bug

When deleting a user's quote_mask_id entry from the database, this user can't add to cart because of an error showing "Could not add item to cart. Please check required options and try again.". However, in the network, this error shows Could not find a cart with ID "XXX". This means that the error was not catched by the cart AsyncActions isInvalidCart method, but it instead reached the unknown error flow in ProductFullDetail.

Alternatively, this error also happens when we manually change the is_active value of the quote entry in the quote table. We get the network error "The cart isn't active" and the user can't add to cart anymore.

A browser refresh does reset the cart properly, but we were expecting the add to cart action to also reset cart when the cart ID is invalid.

To reproduce

  1. Go to a product page
  2. Add the product to your cart.
  3. Delete the user's quote_id_mask entry in the quote_id_mask db table
  4. Add the same product to your cart.
  5. Notice the error on the add to cart action.

Expected behavior The add to cart action resets the cart Id if it is invalid and the user can proceed with adding to cart.

Screenshots

cart_id_issue image (80)

Please complete the following device information:

m2-assistant[bot] commented 11 months ago

Hi @simonmarcoux-valtech. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information. Add a comment to assign the issue: @magento I am working on this


Join Magento Community Engineering Slack and ask your questions in #github channel.

RaghavendraTirumalasetti commented 10 months ago

We are able to reproduce this issue. Hence issue is confirmed

glo82145 commented 10 months ago

@adobe export issue to JIRA project PWA as Bug

github-jira-sync-bot commented 10 months ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/PWA-3220 is successfully created for this GitHub issue.

glo82145 commented 8 months ago

We have explored this issue and analysed in respect of PWA. We have explored the possibility of fixing it from PWA side but unfortunately it cannot be fixed from Pwa side and its not a valid scenario in magento also. Hence we are closing this ticket .

Please feel free if you have any more update on the same.

fooman commented 8 months ago

@glo82145 I not sure that I fully agree with the assessment:

its not a valid scenario in magento also.

Step 3 Delete the user's quote_id_mask entry in the quote_id_mask db table

is just a shortcut for accelerating what happens for the setting quote lifetime

image

(instead of the manual deletion you could wait 30 days + ensure you have a running Magento cronjob)