Closed
Description
When the page initially loads the formkey that is placed on the page is cached between independent requests. This is not an issue if the entire page loads before the "Add to Cart" button is pressed, however if the Add to Cart is clicked before the Javascript has fully initialized (and therefore the form is actually posted via a standard POST HTTP request) then the formkey that is sent in the form data does not match the users session and the product is not added to the cart.
Preconditions
- Magento CE 2.2.2 with sample data installed
- Full Page Cache enabled
- Redirect to cart on "Add to Cart" set to yes in configuration (Sales>Checkout>Shopping Cart)
Steps to reproduce
- Open a browser window and navigate to a product page.
- View the page source and search for the formkey that is part of product_addtocartform form (form id)
- Note the form_key down
- Open an incognito window and navigate to the same product page
- View the page source again and search for the form_key field
Expected result
- The two form_key values should be different
Actual result
- The two form_key values are the same (meaning the second one is wrong as it will not match the cookie)
Additional information
- detailed explanation Add to Cart Form wrong Form Key in FPC #13746 (comment)
- confirmed for
2.4-develop
Add to Cart Form wrong Form Key in FPC #13746 (comment)
Metadata
Metadata
Assignees
Labels
Gate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedGate 4. Acknowledged. Issue is added to backlog and ready for developmentOnce P0 defects have been fixed, a defect having this priority is the next candidate for fixing.The issue has been reproduced on latest 2.4-develop branchAffects non-critical data or functionality and does not force users to employ a workaround.Issue is ready to me triaged with Product Manager
Type
Projects
Status
Done