-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Cart token is not refreshed even when invalid #2592
Comments
Moreover we need to fix |
Hi Piotr *** strange thing is, once it happened and push you back to homepage, then you try to remake order again, it succeeded. |
I found out the way to fix it: in core/modules/cart/store/action.ts, this basically avoid the token error (originally it turn the cart token to null, and 'remake order' won't generate the new token for the cart, leads to the error 'no such entity with cartID = null'); |
@michhy with the proposed fix it might happen that we'll clear the server side cart BEFORE order was being transferred to Magento and being placed -> Risky. Shouldn't we instead call |
@pkarw Yea, you are right. and it seems fine, fixed the cartID token issue and also clear the cart item from server. |
OK, cool - could You propose a PR with this fix please? |
@pkarw it might sounds ridiculous, this is my first time working on github projects, I even donno how to fork my project and merge the updates, I did it all by copy and paste (compare my old code and embed the updates).... :'( Thanks :P |
I think this one could be helpfull: https://help.github.com/en/articles/creating-a-pull-request |
Current behavior
There are some certain situation where the current shopping cart (stored in the localStorage
shop/carts/current-cart-token
) is no longer valid. For example, the quote has been closed server side.In this case the
shipping-methods
andpayment-methods
,totals
all subsequent calls return an issue like{"code":500,"result":"No such entity with cartId = null"}
In this situation the solution is to clear the local storage - as after that the new shopping cart id will be retrieved.
We should re-create shopping cart (to get new token/id automatically).
An example on how can we recreate the cart:
https://github.com/pkarw/vue-storefront/blob/f90f64de9cb3ce02e0f5c92d6ceba51014a066ca/core/modules/cart/store/actions.ts#L662
Expected behavior
Steps to reproduce the issue
This issue is not occurring all the time - to be honest, it's pretty hard to recreate it. I used to have when I've logged in as a user after 5-6months of inactivity. The user account has some quote id assigned (like 5561) which has been no longer valid.
We can probably reproduce this issue by manually setting the
localStorage
keyshop/carts/current-cart-token
to random value and testing the subsequent cart synchronization logicThe text was updated successfully, but these errors were encountered: