{"section":"known-issues","requestedLocale":"en","requestedSlug":"cart-does-not-update-in-faststore-if-external-request-is-made-to-update-orderform","locale":"en","slug":"cart-does-not-update-in-faststore-if-external-request-is-made-to-update-orderform","path":"docs/en/known-issues/FastStore/cart-does-not-update-in-faststore-if-external-request-is-made-to-update-orderform.md","branch":"main","content":"## Summary\n\nThe FastStore cart is created/updated via _ValidateCartMutation_.\n\nIf an external request occurs that updates/complements/enriches the cart, such as `POST /attachments/marketingData`, the cart loses its reference and it is not possible to add another product on the first attempt. External calls that change the orderForm can leave the cart stale, which means that the items in the cart have changed outside the customer's standard flow in the store and no longer have the same cart state as the customer has stored in the browser. When this happens, the first _validateCartMutation_ request is ignored (for example, the customer adding another product), and then the current version of the orderForm is returned, and this new product is not added to the cart.\n\nWe noticed that this behavior occurs in both v2 and v3 of the `@faststore/api` package.\n\n## Simulation\n\nYou can validate this behavior by making the following requests:\n\n1. Add a product to the cart via `POST ValidateCartMutation`;\n2. Add marketing data via `POST api/checkout/pub/orderForm/{{id}}/attachments/marketingData`;\n3. Add another product to the cart via `POST ValidateCartMutation`.\n\nWhen you add the second item to the cart, it will not be added. It will have to be added again.\n\nPS: It is important to notice that the `marketingData` is just an example; this KI can happen with any external request that may be made to update the orderForm.\n\n## Workaround\n\nAfter each and every request that updates the cart (step 2 in the example above), it will be necessary to retrieve the current cart information and update it, as suggested by the implementation below:\n\n    await axios.post('/api/marketingdata', payload)// update cart storeconst updatedCart = cartStore.read()cartStore.set(updatedCart)This will make sure that the cart is up to date so that when the customer adds more products, the cart is with up-to-date information."}