Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Consider order number from Checkout cookie (#2592)
## What's the purpose of this pull request? This PR intends to change how we set the order number value on `@faststore/api`. ## How it works? Currently, we set the `orderNumber` value as the one we receive from client-side's storage context. After the order placed, Checkout generates a new order number (a new cart) and send it through the `checkout.vtex.com` cookie, but we do not update this value in the client-side's storage context until the `validateCart` resolver is executed (in the next `ValidateCartMutation` request). At the resolver, we always consider the order number's default value as being the one from client-side's storage context, not the updated one incoming from Checkout cookie. So with this change we will consider the order number value from the `checkout.vtex.com` cookie as the default one, and change the other to be the fallback case. ## How to test it? The following store was created to validate the scenario with both storefront and checkout integrated on the same domain: https://teste.paladino.co/ Perform the entire checkout flow. The payment type should be with "money". After the order placed, check the `orderFormId` in `checkout.vtex.com` cookie, it should be a new one. When returning to the store also check the `orderFormId` from storage context, it should be the same as the cookie one. The cart should be empty too. We need to check if, aside from the order placed flow, everything is working properly on a current store (use the `starter.store` preview, with the secure subdomain), add/remove items in the cart, clear the cart, go to checkout etc. ### Starters Deploy Preview vtex-sites/starter.store#647 --------- Co-authored-by: Emerson Laurentino <emerson@laurentino.co>
- Loading branch information